doctree = xmlParseMemory((char *) VARDATA(t), docsize);
if (doctree == NULL)
- {
- xmlCleanupParser();
PG_RETURN_BOOL(false); /* i.e. not well-formed */
- }
xmlFreeDoc(doctree);
- xmlCleanupParser();
PG_RETURN_BOOL(true);
}
xpres = pgxml_result_to_text(pgxml_xpath(PG_GETARG_TEXT_P(0), xpath),
toptag, septag, NULL);
- /* xmlCleanupParser(); done by result_to_text routine */
pfree(xpath);
if (xpres == NULL)
xpres = pgxml_result_to_text(pgxml_xpath(PG_GETARG_TEXT_P(0), xpath),
NULL, NULL, plainsep);
- /* xmlCleanupParser(); done by result_to_text routine */
pfree(xpath);
if (xpres == NULL)
xpres = pgxml_result_to_text(pgxml_xpath(PG_GETARG_TEXT_P(0), xpath),
NULL, NULL, NULL);
- xmlCleanupParser();
pfree(xpath);
if (xpres == NULL)
pfree(xpath);
if (res == NULL)
- {
- xmlCleanupParser();
PG_RETURN_NULL();
- }
fRes = xmlXPathCastToNumber(res);
- xmlCleanupParser();
+
if (xmlXPathIsNaN(fRes))
PG_RETURN_NULL();
pfree(xpath);
if (res == NULL)
- {
- xmlCleanupParser();
PG_RETURN_BOOL(false);
- }
bRes = xmlXPathCastToBoolean(res);
- xmlCleanupParser();
+
PG_RETURN_BOOL(bRes);
}
doctree = xmlParseMemory((char *) VARDATA(document), docsize);
if (doctree == NULL)
- { /* not well-formed */
- return NULL;
- }
+ return NULL; /* not well-formed */
ctxt = xmlXPathNewContext(doctree);
ctxt->node = xmlDocGetRootElement(doctree);
comppath = xmlXPathCompile(xpath);
if (comppath == NULL)
{
- xmlCleanupParser();
xmlFreeDoc(doctree);
elog_error("XPath Syntax Error", true);
}
if (res == NULL)
{
xmlXPathFreeContext(ctxt);
- /* xmlCleanupParser(); */
xmlFreeDoc(doctree);
return NULL;
text *xpres;
if (res == NULL)
- {
- xmlCleanupParser();
return NULL;
- }
+
switch (res->type)
{
case XPATH_NODESET:
VARATT_SIZEP(xpres) = ressize + VARHDRSZ;
/* Free various storage */
- xmlCleanupParser();
- /* xmlFreeDoc(doctree); -- will die at end of tuple anyway */
-
xmlFree(xpresstr);
elog_error("XPath error", false);
comppath = xmlXPathCompile(xpaths[j]);
if (comppath == NULL)
{
- xmlCleanupParser();
xmlFreeDoc(doctree);
elog_error("XPath Syntax Error", true);
}
pfree(xmldoc);
}
- xmlCleanupParser();
-
tuplestore_donestoring(tupstore);
SPI_finish();