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 363252 - proximity position in libxml2's xmlXPathEvalExpression()
proximity position in libxml2's xmlXPathEvalExpression()
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
2.6.x
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2006-10-18 21:43 UTC by Marius Konitzer
Modified: 2006-11-18 16:42 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Marius Konitzer 2006-10-18 21:43:51 UTC
Consider the following XML document:

<test><!-- a --><somenode><!-- b --></somenode><!-- c --></test>

and let libxml2 evaluate the XPath expression "//comment()" on it.
libxml2 returns node-set (a,c,b) instead of (a,b,c), that I would have
expected. To be exact, "(//comment())[2]" gives singleton (c) instead of
the expected (b).
W3C's XPath recommendation indeed states, that predicates are to
determine "the position of the node in the node-set ordered in document
order if the axis is a forward axis" [1], which should be the case here.

On Wed, 2006-10-18 at 17:26 -0400, Daniel Veillard wrote:
> There is a good workaround, call xmlXPathOrderDocElems() on your
> document before running XPath queries on it, that fixes it and will
> speed up some XPath operations a lot. 

Confirmed, that works for the time being.

Thanks!
Marius
Comment 1 William M. Brack 2006-11-18 16:42:47 UTC
This problem was introduced around last May, when some coding to speed up node list comparisons was implemented.  I have made a small enhancement which I believe should fix it (it certainly fixes the test case).  Please try the current CVS code on your original data, and re-open the bug if there are any further problems.

Thanks for the clear information which you provided!