Re: [xml] xmllint and namespaces



On Fri, Oct 25, 2002 at 10:45:24AM +0200, Stefan Kost wrote:
I don't get it. I read the XPath spec over and over again, but there is nothing 
that convinces me that I am doing something wrong.

  you need to read more then,

before using the context. Now that namespace has a "ns->prefix==NULL", should I 
still attach it or better use
      ctxt->namespaces=NULL;
      ctxt->nsNr=0;
It seems to make no difference. I don't use "xmlXPathRegisterNs()" as there is 
no version of it accepting a xmlNsPtr.

Repeat after me 
 "There is no notion of a default namespace in an XPath query"

As a result libml2 does NOT allot to define a default namespace for
an XPath context. 

<bar xmlns="http://example.com/foo"/>

cannot be seclected with
"//bar"

it can be selected with
"//foo:bar" when the XPath context contains a namespace binding
for the foo prefix mapping to the namespace name "http://example.com/foo";.
Just do it ! There is NO other way.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]