XMLRoot() function

The XMLRoot() function creates an XML value by providing version and stand-alone properties in the XML root information (prolog) of a specified value of type XML. This creates the root node if it does not exist. Typically, this is done to ensure data-model compliance.

Syntax

The XMLRoot() function has the following syntax:
XML = XMLRoot(XML input, float version, bool standalone);

The input value specifies the XML object to update.

The version value specifies the version property of the input XML object.

The standalone value specifies the stand-alone property of the input XML object.

Returns

The function returns the updated object. If a prolog exists, an error is returned.

Example

INSERT INTO employees ( id, xvalue)
VALUES (1001,
XMLROOT (XMLPARSE ('<Emp> John Smith </Emp>'), '1.0', true)