XML Functions
XML functions in MariaDB Server: EXTRACTVALUE() reads text from an XML fragment with an XPath expression, and UPDATEXML() replaces part of it.
MariaDB Server provides two functions for working with XML fragments stored as strings. Both take an XPath expression that selects the part of the fragment to work on.
EXTRACTVALUE returns the text content of the elements that an XPath expression matches.
UPDATEXML replaces the element that an XPath expression matches with a new XML fragment, and returns the changed fragment.
SELECT ExtractValue('<a><b>x</b><b>y</b></a>', '/a/b[2]') AS extracted,
UpdateXML('<a><b>x</b></a>', '/a/b', '<c>z</c>') AS updated;+-----------+-----------------+
| extracted | updated |
+-----------+-----------------+
| y | <a><c>z</c></a> |
+-----------+-----------------+The Feature_xml status variable counts how often these functions have been used.
Other XML Features
XMLTYPE is a data type for storing XML data, available from MariaDB 12.3.
LOAD XML reads data from an XML file into a table.
The CONNECT XML table type accesses an XML file as a table.
The
--xmloption of the mariadb client and of mariadb-dump produces XML output.
This page is licensed: CC BY-SA / Gnu FDL
Last updated
Was this helpful?

