[xml] Possible bug in xmlXPathEvalPathExpr - patch included

Date view Thread view Subject view Author view

From: marcus@levonline.com
Date: Wed Jul 19 2000 - 12:36:15 EDT


Version 2.2.0.

I tried to evaluate the string "string('hello')" and found that XPath
returned the context node instead of the string 'hello'. I found that
xmlXPathEvalPathExpr pushes nodelist on the stack after using
xmlXPathEvalFilterExpr, which returns on the stack as well. If this
is an error, patch is included below to fix this:

--- xpath.c~ Fri Jul 14 16:25:00 2000
+++ xpath.c Wed Jul 19 18:24:42 2000
@@ -3693,14 +3693,16 @@
 
        name = xmlXPathScanName(ctxt);
        if ((name == NULL) || (!xmlXPathIsFunction(ctxt, name)))
+ {
            xmlXPathEvalLocationPath(ctxt);
+ if (ctxt->context->nodelist != NULL)
+ valuePush(ctxt,
xmlXPathNewNodeSetList(ctxt->context->nodelist));
+ }
        else
            xmlXPathEvalFilterExpr(ctxt);
        if (name != NULL)
            xmlFree(name);
 
- if (ctxt->context->nodelist != NULL)
- valuePush(ctxt, xmlXPathNewNodeSetList(ctxt->context->nodelist));
     }
 }
 

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


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Aug 02 2000 - 12:30:23 EDT