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

Function xmlXPathStringLengthFunction

ThirdParty/libxml2/vtklibxml2/xpath.c:7876–7904  ·  view source on GitHub ↗

* xmlXPathStringLengthFunction: * @ctxt: the XPath Parser context * @nargs: the number of arguments * * Implement the string-length() XPath function * number string-length(string?) * The string-length returns the number of characters in the string * (see [3.6 Strings]). If the argument is omitted, it defaults to * the context node converted to a string, in other words the value * of

Source from the content-addressed store, hash-verified

7874 * of the context node.
7875 */
7876void
7877xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs) {
7878 xmlXPathObjectPtr cur;
7879
7880 if (nargs == 0) {
7881 if ((ctxt == NULL) || (ctxt->context == NULL))
7882 return;
7883 if (ctxt->context->node == NULL) {
7884 valuePush(ctxt, xmlXPathCacheNewFloat(ctxt, 0));
7885 } else {
7886 xmlChar *content;
7887
7888 content = xmlXPathCastNodeToString(ctxt->context->node);
7889 if (content == NULL)
7890 xmlXPathPErrMemory(ctxt);
7891 valuePush(ctxt, xmlXPathCacheNewFloat(ctxt,
7892 xmlUTF8Strlen(content)));
7893 xmlFree(content);
7894 }
7895 return;
7896 }
7897 CHECK_ARITY(1);
7898 CAST_TO_STRING;
7899 CHECK_TYPE(XPATH_STRING);
7900 cur = valuePop(ctxt);
7901 valuePush(ctxt, xmlXPathCacheNewFloat(ctxt,
7902 xmlUTF8Strlen(cur->stringval)));
7903 xmlXPathReleaseObject(ctxt->context, cur);
7904}
7905
7906/**
7907 * xmlXPathConcatFunction:

Callers

nothing calls this directly

Calls 7

valuePushFunction · 0.85
xmlXPathCacheNewFloatFunction · 0.85
xmlXPathCastNodeToStringFunction · 0.85
xmlXPathPErrMemoryFunction · 0.85
xmlUTF8StrlenFunction · 0.85
valuePopFunction · 0.85
xmlXPathReleaseObjectFunction · 0.85

Tested by

no test coverage detected