postgresql_16:9.6.50.2 Description of Functions
PostgreSQL 16 > Appendixes > Additional Supplied Modules and Extensions > xml2 — XPath querying and XSLT functionality > Description of Functions
(see xml2-functions-table) shows the functions provided by this module. These functions provide straightforward XML parsing and XPath queries.
| Function Description | | --- | | xml_valid ( document text ) boolean Parses the given document and returns true if the document is well-formed XML. (Note: this is an alias for the standard PostgreSQL function xml_is_well_formed(). The name xml_valid() is technically incorrect since validity and well-formedness have different meanings in XML.) | | xpath_string ( document text, query text ) text Evaluates the XPath query on the supplied document, and casts the result to text. | | xpath_number ( document text, query text ) real Evaluates the XPath query on the supplied document, and casts the result to real. | | xpath_bool ( document text, query text ) boolean Evaluates the XPath query on the supplied document, and casts the result to boolean. | | xpath_nodeset ( document text, query text, toptag text, itemtag text ) text Evaluates the query on the document and wraps the result in XML tags. If the result is multivalued, the output will look like: <toptag> <itemtag>Value 1 which could be an XML fragment</itemtag> <itemtag>Value 2....</itemtag> </toptag> If either toptag or itemtag is an empty string, the relevant tag is omitted. | | xpath_nodeset ( document text, query text, itemtag text ) text Like xpath_nodeset(document, query, toptag, itemtag) but result omits toptag. | | xpath_nodeset ( document text, query text ) text Like xpath_nodeset(document, query, toptag, itemtag) but result omits both tags. | | xpath_list ( document text, query text, separator text ) text Evaluates the query on the document and returns multiple values separated by the specified separator, for example Value 1,Value 2,Value 3 if separator is ,. | | xpath_list ( document text, query text ) text This is a wrapper for the above function that uses , as the separator. |