MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlXPathEval

Function xmlXPathEval

ThirdParty/libxml2/vtklibxml2/xpath.c:13287–13315  ·  view source on GitHub ↗

* xmlXPathEval: * @str: the XPath expression * @ctx: the XPath context * * Evaluate the XPath Location Path in the given context. * * Returns the xmlXPathObjectPtr resulting from the evaluation or NULL. * the caller has to free the object. */

Source from the content-addressed store, hash-verified

13285 * the caller has to free the object.
13286 */
13287xmlXPathObjectPtr
13288xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) {
13289 xmlXPathParserContextPtr ctxt;
13290 xmlXPathObjectPtr res;
13291
13292 if (ctx == NULL)
13293 return(NULL);
13294
13295 xmlInitParser();
13296
13297 xmlResetError(&ctx->lastError);
13298
13299 ctxt = xmlXPathNewParserContext(str, ctx);
13300 if (ctxt == NULL)
13301 return NULL;
13302 xmlXPathEvalExpr(ctxt);
13303
13304 if (ctxt->error != XPATH_EXPRESSION_OK) {
13305 res = NULL;
13306 } else if (ctxt->valueNr != 1) {
13307 xmlXPathErr(ctxt, XPATH_STACK_ERROR);
13308 res = NULL;
13309 } else {
13310 res = valuePop(ctxt);
13311 }
13312
13313 xmlXPathFreeParserContext(ctxt);
13314 return(res);
13315}
13316
13317/**
13318 * xmlXPathSetContextNode:

Callers 5

doXPathQueryFunction · 0.85
xmlXPathNodeEvalFunction · 0.85
xmlXPathEvalExpressionFunction · 0.85
xmlSchematronGetNodeFunction · 0.85
xmlShellFunction · 0.85

Calls 7

xmlInitParserFunction · 0.85
xmlResetErrorFunction · 0.85
xmlXPathNewParserContextFunction · 0.85
xmlXPathEvalExprFunction · 0.85
xmlXPathErrFunction · 0.85
valuePopFunction · 0.85

Tested by

no test coverage detected