mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 22:43:04 +00:00
* Addendum to r62773 (I don't know how did this file escape earlier).
svn path=/trunk/; revision=62783
This commit is contained in:
parent
b9ecc0ff3f
commit
c951aa0ebc
1 changed files with 44 additions and 1 deletions
45
reactos/lib/3rdparty/libxml2/xpath.c
vendored
45
reactos/lib/3rdparty/libxml2/xpath.c
vendored
|
@ -12399,7 +12399,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (cur->type == type) {
|
} else if (cur->type == type) {
|
||||||
if (type == XML_NAMESPACE_DECL)
|
if (cur->type == XML_NAMESPACE_DECL)
|
||||||
XP_TEST_HIT_NS
|
XP_TEST_HIT_NS
|
||||||
else
|
else
|
||||||
XP_TEST_HIT
|
XP_TEST_HIT
|
||||||
|
@ -15078,6 +15078,49 @@ xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) {
|
||||||
return(res);
|
return(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlXPathSetContextNode:
|
||||||
|
* @node: the node to to use as the context node
|
||||||
|
* @ctx: the XPath context
|
||||||
|
*
|
||||||
|
* Sets 'node' as the context node. The node must be in the same
|
||||||
|
* document as that associated with the context.
|
||||||
|
*
|
||||||
|
* Returns -1 in case of error or 0 if successful
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
xmlXPathSetContextNode(xmlNodePtr node, xmlXPathContextPtr ctx) {
|
||||||
|
if ((node == NULL) || (ctx == NULL))
|
||||||
|
return(-1);
|
||||||
|
|
||||||
|
if (node->doc == ctx->doc) {
|
||||||
|
ctx->node = node;
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlXPathNodeEval:
|
||||||
|
* @node: the node to to use as the context node
|
||||||
|
* @str: the XPath expression
|
||||||
|
* @ctx: the XPath context
|
||||||
|
*
|
||||||
|
* Evaluate the XPath Location Path in the given context. The node 'node'
|
||||||
|
* is set as the context node. The context node is not restored.
|
||||||
|
*
|
||||||
|
* Returns the xmlXPathObjectPtr resulting from the evaluation or NULL.
|
||||||
|
* the caller has to free the object.
|
||||||
|
*/
|
||||||
|
xmlXPathObjectPtr
|
||||||
|
xmlXPathNodeEval(xmlNodePtr node, const xmlChar *str, xmlXPathContextPtr ctx) {
|
||||||
|
if (str == NULL)
|
||||||
|
return(NULL);
|
||||||
|
if (xmlXPathSetContextNode(node, ctx) < 0)
|
||||||
|
return(NULL);
|
||||||
|
return(xmlXPathEval(str, ctx));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlXPathEvalExpression:
|
* xmlXPathEvalExpression:
|
||||||
* @str: the XPath expression
|
* @str: the XPath expression
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue