Commit 5a2b697a authored by Daniel Veillard's avatar Daniel Veillard
Browse files

- xpath.c: seems I finally killed that ugly path evaluation

  context bug (tagged 9999 in case is is wrong)
Daniel
parent 8f4d9757
Fri Jan 19 18:15:50 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* xpath.c: seems I finally killed that ugly path evaluation
context bug (tagged 9999 in case is is wrong)
Fri Jan 19 06:30:38 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* xpath.[ch] xpathInternals.h: added xmlXPathRegisterVariableLookup()
......
......@@ -570,6 +570,10 @@ xmlChar * xmlGetProp (xmlNodePtr node,
const xmlChar *name);
xmlAttrPtr xmlHasProp (xmlNodePtr node,
const xmlChar *name);
xmlAttrPtr xmlSetNsProp (xmlNodePtr node,
xmlNsPtr ns,
const xmlChar *name,
const xmlChar *value);
xmlChar * xmlGetNsProp (xmlNodePtr node,
const xmlChar *name,
const xmlChar *nameSpace);
......
......@@ -570,6 +570,10 @@ xmlChar * xmlGetProp (xmlNodePtr node,
const xmlChar *name);
xmlAttrPtr xmlHasProp (xmlNodePtr node,
const xmlChar *name);
xmlAttrPtr xmlSetNsProp (xmlNodePtr node,
xmlNsPtr ns,
const xmlChar *name,
const xmlChar *value);
xmlChar * xmlGetNsProp (xmlNodePtr node,
const xmlChar *name,
const xmlChar *nameSpace);
......
......@@ -1241,7 +1241,10 @@ xmlXPathNewString(const xmlChar *val) {
}
memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
ret->type = XPATH_STRING;
ret->stringval = xmlStrdup(val);
if (val != NULL)
ret->stringval = xmlStrdup(val);
else
ret->stringval = xmlStrdup((const xmlChar *)"");
return(ret);
}
......@@ -3481,7 +3484,8 @@ xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs) {
int i = 0; /* Should be first in document order !!!!! */
res = xmlNodeGetContent(cur->nodesetval->nodeTab[i]);
valuePush(ctxt, xmlXPathNewString(res));
xmlFree(res);
if (res != NULL)
xmlFree(res);
}
xmlXPathFreeObject(cur);
return;
......@@ -4560,6 +4564,7 @@ xmlXPathEvalVariableReference(xmlXPathParserContextPtr ctxt) {
if (CUR != '$') {
XP_ERROR(XPATH_VARIABLE_REF_ERROR);
}
NEXT;
name = xmlXPathParseQName(ctxt, &prefix);
if (name == NULL) {
XP_ERROR(XPATH_VARIABLE_REF_ERROR);
......@@ -4922,6 +4927,10 @@ xmlXPathEvalPathExpr(xmlXPathParserContextPtr ctxt) {
if (lc) {
if (CUR == '/')
xmlXPathRoot(ctxt);
else {
/* TAG:9999 */
valuePush(ctxt, xmlXPathNewNodeSet(ctxt->context->node));
}
xmlXPathEvalLocationPath(ctxt);
} else {
xmlXPathEvalFilterExpr(ctxt);
......@@ -5869,10 +5878,12 @@ xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) {
CHECK_CONTEXT(ctx)
ctxt = xmlXPathNewParserContext(str, ctx);
/**** TAG:9999
if (ctx->node != NULL) {
init = xmlXPathNewNodeSet(ctx->node);
valuePush(ctxt, init);
}
****/
xmlXPathEvalExpr(ctxt);
if (ctxt->value == NULL) {
......
......@@ -1337,10 +1337,12 @@ xmlXPtrEval(const xmlChar *str, xmlXPathContextPtr ctx) {
return(NULL);
ctxt = xmlXPathNewParserContext(str, ctx);
/* TAG:9999
if (ctx->node != NULL) {
init = xmlXPathNewNodeSet(ctx->node);
valuePush(ctxt, init);
}
*/
xmlXPtrEvalXPointer(ctxt);
if ((ctxt->value != NULL) &&
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment