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

Function xmlXPathCompareNodeSetString

ThirdParty/libxml2/vtklibxml2/xpath.c:5507–5540  ·  view source on GitHub ↗

* xmlXPathCompareNodeSetString: * @ctxt: the XPath Parser context * @inf: less than (1) or greater than (0) * @strict: is the comparison strict * @arg: the node set * @s: the value * * Implement the compare operation between a nodeset and a string * @ns < @val (1, 1, ... * @ns <= @val (1, 0, ... * @ns > @val (0, 1, ... * @ns >= @val (0, 0, ... * * If one

Source from the content-addressed store, hash-verified

5505 * Returns 0 or 1 depending on the results of the test.
5506 */
5507static int
5508xmlXPathCompareNodeSetString(xmlXPathParserContextPtr ctxt, int inf, int strict,
5509 xmlXPathObjectPtr arg, xmlXPathObjectPtr s) {
5510 int i, ret = 0;
5511 xmlNodeSetPtr ns;
5512 xmlChar *str2;
5513
5514 if ((s == NULL) || (arg == NULL) ||
5515 ((arg->type != XPATH_NODESET) && (arg->type != XPATH_XSLT_TREE))) {
5516 xmlXPathReleaseObject(ctxt->context, arg);
5517 xmlXPathReleaseObject(ctxt->context, s);
5518 return(0);
5519 }
5520 ns = arg->nodesetval;
5521 if (ns != NULL) {
5522 for (i = 0;i < ns->nodeNr;i++) {
5523 str2 = xmlXPathCastNodeToString(ns->nodeTab[i]);
5524 if (str2 != NULL) {
5525 valuePush(ctxt,
5526 xmlXPathCacheNewString(ctxt, str2));
5527 xmlFree(str2);
5528 valuePush(ctxt, xmlXPathCacheObjectCopy(ctxt, s));
5529 ret = xmlXPathCompareValues(ctxt, inf, strict);
5530 if (ret)
5531 break;
5532 } else {
5533 xmlXPathPErrMemory(ctxt);
5534 }
5535 }
5536 }
5537 xmlXPathReleaseObject(ctxt->context, arg);
5538 xmlXPathReleaseObject(ctxt->context, s);
5539 return(ret);
5540}
5541
5542/**
5543 * xmlXPathCompareNodeSets:

Callers 1

Calls 7

xmlXPathReleaseObjectFunction · 0.85
xmlXPathCastNodeToStringFunction · 0.85
valuePushFunction · 0.85
xmlXPathCacheNewStringFunction · 0.85
xmlXPathCacheObjectCopyFunction · 0.85
xmlXPathCompareValuesFunction · 0.85
xmlXPathPErrMemoryFunction · 0.85

Tested by

no test coverage detected