I added this peace of code for testing: xpathexpression = ("//p"); // this is a legal xpath expression xpathObj = xmlXPathEvalExpression (xpathexpression, xpathCtx); if(xmlXPathNodeSetIsEmpty(xpathObj->nodesetval)){ printf("Node set is empty\n"); return NULL; }I also have to conclude the same: xmlXPathEvalExpression always returns an object with a empty node list, whatever xpathexpression is used. I have no clue why :(. The code looks ok to me. Are you sure xpathCtx points to the right context?
On 12/01/2010 17:58, Bert Frees wrote:
I'm not an xpath expert either, but i'll take a look at the code tomorrow.Bert On 12/01/2010 17:20, John J. Boyer wrote:Thanks for your patience in testing this feature. Perhaps you can give me some clues as to why an xpath expression might be evaluated without errors but return an empty node set, though the document contains nodes to which it should apply. After parsing the document I set up an xpath context, Then look through a table for xpath expressions. If one is found, it is evaluated with the context to produce an xpath object. The object is then examined for whatever nodes it may contain and freed. The scan of the table continues. When it is done the context is also freed. The code is in do_xpath_expr in the semantics.c module. Thanks, JohnFor a description of the software and to download it go to http://www.jjb-software.com
For a description of the software and to download it go to http://www.jjb-software.com