[xml] XPath relative search?




After downloading:

libxml2-2.5.11-1.i386.rpm

and installing on a new RH9 system, the following occurs while 
debugging a program which is supposed to do a relative XPath search:

--------------

(gdb) next
129       xp_context = xmlXPathNewContext(doc) ;
(gdb) next
130       xp_context->node = node ;
(gdb) next
131       if (!(xp_result = xmlXPathEval("//text",xp_context))) FAIL_SUB ;
(gdb) print xp_context->node->type
$29 = XML_ELEMENT_NODE
(gdb) print xp_context->node->name
$30 = (const xmlChar *) 0x8063a30 "instance"
(gdb) next
132       if ((xp_nodes = xp_result->nodesetval)) {
(gdb) print xp_context->node->type
$31 = XML_DOCUMENT_NODE                       <---- huh??
(gdb) print xp_context->node->name
$32 = (const xmlChar *) 0x0                   <---- huh??

--------------

That is, the act of calling xmlXPathEval seems to reset the
xmlXPathNewContext to the top of the document.  

How, then, does one do a relative XPath search?  I'm mystified.
Any help is appreciated.

Christopher Grayce
cgrayce at aleks dot com



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