postgresql_16:3.5.13 XML Type
PostgreSQL 16 > The SQL Language > Data Types > XML Type
The xml data type can be used to store XML data. Its advantage over storing XML data in a text field is that it checks the input values for well-formedness, and there are support functions to perform type-safe operations on it; see (see postgresql_16:3.6.15). Use of this data type requires the installation to have been built with configure --with-libxml.
The xml type can store well-formed “documents”, as defined by the XML standard, as well as “content” fragments, which are defined by reference to the more permissive “document node” of the XQuery and XPath data model. Roughly, this means that content fragments can have more than one top-level element or character node. The expression *xmlvalue* IS DOCUMENT can be used to evaluate whether a particular xml value is a full document or only a content fragment.
Limits and compatibility notes for the xml data type can be found in (see postgresql_16:9.4.3).
Subsections
- postgresql_16:3.5.13.1 Creating XML Values
- postgresql_16:3.5.13.2 Encoding Handling
- postgresql_16:3.5.13.3 Accessing XML Values