After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 57644 - XPath processing and default namespaces
XPath processing and default namespaces
Status: VERIFIED NOTABUG
Product: libxml
Classification: Deprecated
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
Daniel Veillard
Depends on:
Blocks:
 
 
Reported: 2001-07-17 07:40 UTC by goevert
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description goevert 2001-07-17 07:40:39 UTC
textXPath produces weird result if a default namespace is specified in 
a given xml document. Example: Contents of test.xml is:

<foo  xmlns="http://bar/"/>

Results of testXPath from libxml2 2.3.14 and 2.4.0:

[goevert@charlie] ./testXPath -i ~/tmp/test.xml /foo
Object is a Node Set :
Set contains 0 nodes:

I would have expected what I do get with libxml2 2.3.9:

[goevert@charlie] ./testXPath -i ~/tmp/test.xml /foo
Object is a Node Set :
Set contains 1 nodes:
1  ELEMENT foo
    default namespace href=http://bar/

If test.xml contains only

<foo/>

I get correct results with all versions:

[goevert@charlie] ./testXPath -i ~/tmp/test.xml /foo
Object is a Node Set :
Set contains 1 nodes:
1  ELEMENT foo
Comment 1 Daniel Veillard 2001-07-17 15:20:53 UTC
This is not a bug, it was a bug in previous release and had
been fixed:

http://www.w3.org/TR/xpath#node-tests

-------------------------------
A node test that is a QName is true if and only if the type of
the node (see [5 Data Model]) is the principal node type and has
an expanded-name equal to the expanded-name specified by the QName.
--------------------------------
in the document, the expanded name of the foo element is
   (http://bar/ , foo)
in you XPath query, the expanded name is
   (null , foo)
they don't match !
You need to provide a namespace prefix in the XPath query
and have it defined in the XPath context.

Daniel
Comment 2 Daniel Veillard 2001-08-15 16:03:55 UTC
I think we can close this bug now,

Daniel