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

Function xmlXPathStringFunction

ThirdParty/libxml2/vtklibxml2/xpath.c:7837–7862  ·  view source on GitHub ↗

* xmlXPathStringFunction: * @ctxt: the XPath Parser context * @nargs: the number of arguments * * Implement the string() XPath function * string string(object?) * The string function converts an object to a string as follows: * - A node-set is converted to a string by returning the value of * the node in the node-set that is first in document order. * If the node-set is

Source from the content-addressed store, hash-verified

7835 * context node as its only member.
7836 */
7837void
7838xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs) {
7839 xmlXPathObjectPtr cur;
7840 xmlChar *stringval;
7841
7842 if (ctxt == NULL) return;
7843 if (nargs == 0) {
7844 stringval = xmlXPathCastNodeToString(ctxt->context->node);
7845 if (stringval == NULL)
7846 xmlXPathPErrMemory(ctxt);
7847 valuePush(ctxt, xmlXPathCacheWrapString(ctxt, stringval));
7848 return;
7849 }
7850
7851 CHECK_ARITY(1);
7852 cur = valuePop(ctxt);
7853 if (cur == NULL) XP_ERROR(XPATH_INVALID_OPERAND);
7854 if (cur->type != XPATH_STRING) {
7855 stringval = xmlXPathCastToString(cur);
7856 if (stringval == NULL)
7857 xmlXPathPErrMemory(ctxt);
7858 xmlXPathReleaseObject(ctxt->context, cur);
7859 cur = xmlXPathCacheWrapString(ctxt, stringval);
7860 }
7861 valuePush(ctxt, cur);
7862}
7863
7864/**
7865 * xmlXPathStringLengthFunction:

Callers

nothing calls this directly

Calls 7

xmlXPathCastNodeToStringFunction · 0.85
xmlXPathPErrMemoryFunction · 0.85
valuePushFunction · 0.85
xmlXPathCacheWrapStringFunction · 0.85
valuePopFunction · 0.85
xmlXPathCastToStringFunction · 0.85
xmlXPathReleaseObjectFunction · 0.85

Tested by

no test coverage detected