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

Function xmlXPathEvalExpr

ThirdParty/libxml2/vtklibxml2/xpath.c:13227–13275  ·  view source on GitHub ↗

* xmlXPathEvalExpr: * @ctxt: the XPath Parser context * * Parse and evaluate an XPath expression in the given context, * then push the result on the context stack */

Source from the content-addressed store, hash-verified

13225 * then push the result on the context stack
13226 */
13227void
13228xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) {
13229#ifdef XPATH_STREAMING
13230 xmlXPathCompExprPtr comp;
13231#endif
13232 int oldDepth = 0;
13233
13234 if (ctxt == NULL)
13235 return;
13236 if (ctxt->context->lastError.code != 0)
13237 return;
13238
13239#ifdef XPATH_STREAMING
13240 comp = xmlXPathTryStreamCompile(ctxt->context, ctxt->base);
13241 if ((comp == NULL) &&
13242 (ctxt->context->lastError.code == XML_ERR_NO_MEMORY)) {
13243 xmlXPathPErrMemory(ctxt);
13244 return;
13245 }
13246 if (comp != NULL) {
13247 if (ctxt->comp != NULL)
13248 xmlXPathFreeCompExpr(ctxt->comp);
13249 ctxt->comp = comp;
13250 } else
13251#endif
13252 {
13253 if (ctxt->context != NULL)
13254 oldDepth = ctxt->context->depth;
13255 xmlXPathCompileExpr(ctxt, 1);
13256 if (ctxt->context != NULL)
13257 ctxt->context->depth = oldDepth;
13258 CHECK_ERROR;
13259
13260 /* Check for trailing characters. */
13261 if (*ctxt->cur != 0)
13262 XP_ERROR(XPATH_EXPR_ERROR);
13263
13264 if ((ctxt->comp->nbStep > 1) && (ctxt->comp->last >= 0)) {
13265 if (ctxt->context != NULL)
13266 oldDepth = ctxt->context->depth;
13267 xmlXPathOptimizeExpression(ctxt,
13268 &ctxt->comp->steps[ctxt->comp->last]);
13269 if (ctxt->context != NULL)
13270 ctxt->context->depth = oldDepth;
13271 }
13272 }
13273
13274 xmlXPathRunEval(ctxt, 0);
13275}
13276
13277/**
13278 * xmlXPathEval:

Callers 3

xmlXPathEvalFunction · 0.85
xmlXPtrEvalXPtrPartFunction · 0.85

Calls 6

xmlXPathTryStreamCompileFunction · 0.85
xmlXPathPErrMemoryFunction · 0.85
xmlXPathFreeCompExprFunction · 0.85
xmlXPathCompileExprFunction · 0.85
xmlXPathRunEvalFunction · 0.85

Tested by

no test coverage detected