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", 
"http://www.medcom.dk/DenDynamiskeBlanket/2006-01-30/";) 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
   http://www.w3.org/TR/xpath#node-tests

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
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]