[xml] XPath empty default namespaces (bug?)
- From: "Alex Dron" <avdron infomosaic com>
- To: "Xml Gnome Org" <xml gnome org>
- Subject: [xml] XPath empty default namespaces (bug?)
- Date: Wed, 31 Oct 2001 11:46:25 -0800
Hi,
I'm working on implementation of Canonical XML
(http://www.w3.org/TR/2001/REC-xml-c14n-20010315) and use this library.
The major problem I bump into is incorrect (IMHO) XPath behavior with empty
default namespaces.
Consider test 3.7 of the URL above, the next XPath expression (evaluated
with namespace declaration xmlns:ietf="http://www.ietf.org"):
----------------------------------------------
(//. | //@* | //namespace::*)
[ self::ietf:e1 or (parent::ietf:e1 and not(self::text() or self::e2))
or
count(id("E3")|ancestor-or-self::node()) =
count(ancestor-or-self::node())]
----------------------------------------------
against XML:
----------------------------------------------
<!DOCTYPE doc [
<!ATTLIST e2 xml:space (default|preserve) 'preserve'>
<!ATTLIST e3 id ID #IMPLIED>
]>
<doc xmlns="http://www.ietf.org" xmlns:w3c="http://www.w3.org">
<e1>
<e2 xmlns="">
<e3 id="E3"/>
</e2>
</e1>
</doc>
----------------------------------------------
Should not return <e2> node, but it does! Xerces Xpath works fine with this
example... It adds default attribute, too - libxml doesn't do it by itself,
but I can live with it.
Libxml works correctly if I declare additional namespace (i.e
ns="http://somewhere") using xmlXPathRegisterNs and rewrite XPath expression
as:
----------------------------------------------
(//. | //@* | //namespace::*)
[ self::ietf:e1 or (parent::ietf:e1 and not(self::text() or self::ns:e2))
or
count(id("E3")|ancestor-or-self::node()) =
count(ancestor-or-self::node())]
----------------------------------------------
But it's not workaround for me, because I cannot modify users expressions...
I'm using the latest version of the library. I understand that very few
people will pay attention to the such trifle, but maybe somebody will point
me, whether I could fix it on my own (change sources?) and how feasible it
is...
Regards,
Alex
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]