XML Predicates
xml IS DOCUMENT
Description: IS DOCUMENT returns true if the XML value of the parameter is a correct XML document; if the XML document is incorrect, false is returned. If the parameter is null, a null value is returned.
Return type: bool
xml IS NOT DOCUMENT
Description: Returns true if the XML value of the parameter is not a correct XML document. If the XML document is correct, false is returned. If the parameter is null, a null value is returned.
Return type: bool
XMLEXISTS(text PASSING [BY REF] xml [BY REF])
Description: If the xpath expression in the first parameter returns any node, the XMLEXISTS function returns true. Otherwise, the function returns false. (If any parameter is null, the result is null.) The BY REF clause is invalid and is used to maintain SQL compatibility.
Return type: bool
Example:
1 2 3 4 5 |
SELECT xmlexists('//town[text() = ''Toronto'']' PASSING BY REF '<towns><town>Toronto</town><town>Ottawa</town></towns>'); xmlexists ----------- t (1 row) |
xml_is_well_formed(text)
Description: Checks whether a text string is a well-formatted XML value and returns a Boolean result. If the xmloption parameter is set to DOCUMENT, the document is checked. If the xmloption parameter is set to CONTENT, the content is checked.
Return type: bool
Example:
1 2 3 4 5 |
SELECT xml_is_well_formed('<abc/>'); xml_is_well_formed -------------------- t (1 row) |
xml_is_well_formed_document(text)
Description: Checks whether a text string is a well-formatted text and returns a Boolean result.
Return type: bool
Example:
1 2 3 4 5 |
SELECT xml_is_well_formed_document('<test:foo xmlns:test="http://test.com/test">bar</test:foo>'); xml_is_well_formed_document ----------------------------- t (1 row) |
xml_is_well_formed_content(text)
Description: Checks whether a text string is a well-formatted content and returns a Boolean result.
Return type: bool
Example:
1 2 3 4 5 |
SELECT xml_is_well_formed_content('content'); xml_is_well_formed_content ---------------------------- t (1 row) |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.