* 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). */
| 4188 | * some kind of substitution for XQuery sequences). |
| 4189 | */ |
| 4190 | Datum |
| 4191 | xpath(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 |
nothing calls this directly
no test coverage detected