Re: [xml] Using Xpath with default namespace and null prefix

On Mon, Feb 08, 2010 at 02:03:06PM +0100, Daniel Veillard wrote:
On Mon, Feb 08, 2010 at 01:14:22PM +0100, Iñaki Baz Castillo wrote:

RFC 4825 is a pain as it reuses Xpath 1.0 with some restrictions and additions 
(as the "application default namespace" which allows the Xpath deviation I 
told) so a XML library implementing Xpath 1.0 is not enough valid to implement 
a XCAP client/server :(

  You will have to capture the XPath expression and mofify them before
calling libxml2, there won't be any way around.

The fundamental reason why allowing something like "//foo" to mach an

  to *not* match

element in the default namespace is that this namespace can change
wherever in the document

 <foo xmlns=""/>
 <foo xmlns=""/>

//foo would then returns 3 elements with completely different semantic
coming from different vocabularies. XML being designed for being
extensible XPath had to put a safeguard. Matching in XPath is designed
as a match on the tuple [Namespace URI name , element name] , that's
made 100% clear in the XPath spec, the prefix, present or not, is
completely irrelevant in the XPath query.


Daniel Veillard      | libxml Gnome XML XSLT toolkit
daniel veillard com  | Rpmfind RPM search engine | virtualization library

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