| 349 | PG_FUNCTION_INFO_V1(xpath_number); |
| 350 | |
| 351 | Datum |
| 352 | xpath_number(PG_FUNCTION_ARGS) |
| 353 | { |
| 354 | text *document = PG_GETARG_TEXT_PP(0); |
| 355 | text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ |
| 356 | xmlChar *xpath; |
| 357 | float4 fRes; |
| 358 | xmlXPathObjectPtr res; |
| 359 | xpath_workspace workspace; |
| 360 | |
| 361 | xpath = pgxml_texttoxmlchar(xpathsupp); |
| 362 | |
| 363 | res = pgxml_xpath(document, xpath, &workspace); |
| 364 | |
| 365 | pfree(xpath); |
| 366 | |
| 367 | if (res == NULL) |
| 368 | PG_RETURN_NULL(); |
| 369 | |
| 370 | fRes = xmlXPathCastToNumber(res); |
| 371 | |
| 372 | cleanup_workspace(&workspace); |
| 373 | |
| 374 | if (xmlXPathIsNaN(fRes)) |
| 375 | PG_RETURN_NULL(); |
| 376 | |
| 377 | PG_RETURN_FLOAT4(fRes); |
| 378 | } |
| 379 | |
| 380 | |
| 381 | PG_FUNCTION_INFO_V1(xpath_bool); |
nothing calls this directly
no test coverage detected