[xml] Using variables with XPath expressions

Hi All,

I have a series of XPath expressions that are fairly time-intensive and each
is dependent on the outcome of the previous.  I'm trying to use variables to
simplify the expressions and minimize unnecessary processing.  The following
consistently dumps consistently on 2.3.11:

<?xml version="1.0"?>
<root title="test">
 <node value="test"/>

And the code (simplified to illustrate the point):

ctx = xmlXPathNewContext(doc);
obj = xmlXPathEval("string(/root/@test)",doc);
/* obj returns as expected */
obj = xmlXPathEval("$var",ctx);
/* obj returns as expected */
obj = xmlXPathEval("//node[ value=$var]",ctx);
/* the above crashes */

Any ideas?

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