Re: [xml] Rer: Re: XPath question

On Tue, Nov 21, 2006 at 02:54:25PM +0100, Erik F. Andersen wrote:
The prefix is not "nil". NIL is Delphi syntax for a NULL pointer in C. If you look at the definition for 
xmlns in <DenDynamiskeBlanket> there is no prefix specified.

It is quite obvoius looking at the source in xpath.c why xmlXPathRegisterNs won't work with a NULL prefix. 
It return -1.

  That's normal, and your code should have checked the return code !

If I register the namespace with any prefix for instance xmlXPathRegisterNs("nil", 
"";) XPath will work if I just remember to prefix my 
queries witj "nil" as you suggest.

I just don't get it why it is necessary to register the namespace at all...

  Because that's what the XPath specification says ! Not a bug,
conformance to the spec. A bare name without prefix does not match
namespaced elements or attribute. I suggest you reread section 2.3
of the XPath specification


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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