* 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
| 5505 | * Returns 0 or 1 depending on the results of the test. |
| 5506 | */ |
| 5507 | static int |
| 5508 | xmlXPathCompareNodeSetString(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: |
no test coverage detected