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

Function xpath_number

contrib/xml2/xpath.c:351–378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349PG_FUNCTION_INFO_V1(xpath_number);
350
351Datum
352xpath_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
381PG_FUNCTION_INFO_V1(xpath_bool);

Callers

nothing calls this directly

Calls 4

pgxml_texttoxmlcharFunction · 0.85
pgxml_xpathFunction · 0.85
cleanup_workspaceFunction · 0.85
pfreeFunction · 0.50

Tested by

no test coverage detected