<<<<<<< HEAD xmlstartdoc | H2 | SQLDoc
Skip to main content

xmlstartdoc

1. XMLSTARTDOC Function​

======= xmlstartdoc | H2 Function | SQLDoc

xmlstartdoc

1. XMLSTARTDOC Function​

>>>>>>> 9d19b1c8cb744c8e86d5c15b74d8b5f719ad62be

The XMLSTARTDOC function in H2 database is used to generate the starting tag of an XML document.

2. Syntax​

The syntax for the XMLSTARTDOC function in H2 database is as follows:

XMLSTARTDOC([encoding])

Arguments​

  • encoding (optional): The character encoding to be used in the XML document. If not specified, the default encoding is UTF-8.

Return​

  • The XMLSTARTDOC function returns the opening tag of an XML document.

3. Notes​

  • The XMLSTARTDOC function is mainly used in conjunction with other XML functions in H2 database to generate valid XML documents.
  • The encoding argument specifies the character encoding for the XML document. It helps define how characters are represented within the document.
  • If the encoding argument is not provided, the XML document will be encoded using UTF-8 by default.

4. Examples​

Here are a few examples demonstrating the usage of the XMLSTARTDOC function in H2 database:

Example 1 - Generating an XML document with default encoding:​

SELECT XMLSTARTDOC() AS xml_doc;

Output:

xml_doc
-------
<?xml version="1.0" encoding="UTF-8"?>

Example 2 - Generating an XML document with a specified encoding:​

SELECT XMLSTARTDOC('ISO-8859-1') AS xml_doc;

Output:

xml_doc
-------
<?xml version="1.0" encoding="ISO-8859-1"?>
  • XMLATTRIBUTES - Generate XML attributes
  • xmlcdata - Wrap content in a CDATA section
  • xmlcomment - Generate an XML comment
  • XMLELEMENT - Generate an XML element
  • XMLFOREST - Generate XML from multiple expressions