MCPcopy Create free account
hub / github.com/apache/cloudberry / xpath

Function xpath

src/backend/utils/adt/xml.c:4190–4207  ·  view source on GitHub ↗

* Evaluate XPath expression and return array of XML values. * * As we have no support of XQuery sequences yet, this function seems * to be the most useful one (array of XML functions plays a role of * some kind of substitution for XQuery sequences). */

Source from the content-addressed store, hash-verified

4188 * some kind of substitution for XQuery sequences).
4189 */
4190Datum
4191xpath(PG_FUNCTION_ARGS)
4192{
4193#ifdef USE_LIBXML
4194 text *xpath_expr_text = PG_GETARG_TEXT_PP(0);
4195 xmltype *data = PG_GETARG_XML_P(1);
4196 ArrayType *namespaces = PG_GETARG_ARRAYTYPE_P(2);
4197 ArrayBuildState *astate;
4198
4199 astate = initArrayResult(XMLOID, CurrentMemoryContext, true);
4200 xpath_internal(xpath_expr_text, data, namespaces,
4201 NULL, astate);
4202 PG_RETURN_ARRAYTYPE_P(makeArrayResult(astate, CurrentMemoryContext));
4203#else
4204 NO_XML_SUPPORT();
4205 return 0;
4206#endif
4207}
4208
4209/*
4210 * Determines if the node specified by the supplied XPath exists

Callers

nothing calls this directly

Calls 3

initArrayResultFunction · 0.85
xpath_internalFunction · 0.85
makeArrayResultFunction · 0.85

Tested by

no test coverage detected