[xml] Apparent XPath bug in libxml 2.2.7

Date view Thread view Subject view Author view

From: David Moore (dmoore@its.caltech.edu)
Date: Fri Nov 10 2000 - 23:47:01 EST


I'm not 100% sure if this is a bug, or a change in the API, but I've been
having some trouble with relative XPath queries in 2.2.7 (it worked in
2.2.6 and the few versions before that).

I use the following code:

        sitectx = xmlXPathNewContext(configdoc);
        siteobj = xmlXPathEval("/child::auc/Site", sitectx);
        
        sitectx->node = siteobj->nodesetval->nodeTab[0];
        xpathobj = xmlXPathEval("child::OrganizationName", sitectx);

Basically, I do an xpath query off the document root, in order to find a
node that I'm interested in. Then, I set the context node of my context
structure to the node I just found, and perform a new relative query.

In previous versions of libxml, this has worked just fine, and returned
the desired result. However, in 2.2.7, I get the following error message
when the second xmlXPathEval is executed:

Error xpath.c:2461: Invalid type
child::OrganizationName
                       ^
xmlXPathEval: evaluation failed

This implies that there is a bug in the processing of relative xpath
queries, as the above query should be perfectly valid. I've also tried
various abbreviations for a relative query with no success.

Perhaps I need to do something more than set ctxt->node when setting up
the context structure? Or is this a bug?

By the way, I noticed in the test suite for xpath included with libxml,
there is no testing of relative queries, only absolute. This is probably
why the bug was overlooked.

Thanks for the great software.

Regards,

David

------------------------------------------------------
  David Moore California Institute of Technology
 <dcm@acm.org> http://www.ugcs.caltech.edu/~dmoore
------------------------------------------------------

----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Nov 11 2000 - 04:46:42 EST