XMLSERIALIZE Syntax - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905
XMLSERIALIZE (
  { DOCUMENT | CONTENT } XML_value_expr
  [ AS data_type ]
  [ ENCODING XML_encoding_name ]
  [ WITH [NO] BOM ]
  [ VERSION 'char_str_literal' ]
  [ { INCLUDING | EXCLUDING } XMLDECLARATION ]
  [ NO INDENT | INDENT [ SIZE = integer ] ]
)

Syntax Elements

DOCUMENT
The XML value is an XML document node.
CONTENT
The XML value is an XQuery document node.
XML_value_expr
An instance of the XML type.
data_type
VARCHAR, CLOB, VARBYTE, or BLOB. If data_type is VARCHAR or CLOB, you can specify the character set as LATIN or UNICODE.
CLOB LATIN/UTF16 is only supported on the Block File System on the primary cluster. It is not available for the Object File System.
XML_encoding_name

An identifier for encodings such as ISO-8859-1 that are supported by Vantage.

You can specify the XML encoding specification only if the data type requested is VARBYTE or BLOB.

See Encoding Names Supported by Teradata XML.

WITH [ NO ] BOM

Whether to add a byte order mark to the result.

The WITH BOM directive produces a byte order mark in these cases:
  • Target type is VARBYTE or BLOB and the encoding is a Unicode encoding (UTF-8, UTF-16, or UTF-32/UCS4)
  • Target type is VARCHAR or CLOB with the UNICODE CHARACTER SET and the client character set is UNICODE

In all other cases, the WITH BOM directive does not produce a byte order mark.

Specify the WITH BOM option only with UNICODE client character sets.

VERSION 'char_str_literal'
The XML version to which the serialization conforms. Valid values:
  • '1.0'
  • '1.1'

If not specified or if an invalid value is specified, the default is '1.0'.

INCLUDING XMLDECLARATION or EXCLUDING XMLDECLARATION
Whether the XML declaration (<?xml..?>) occurs at the beginning of the serialization.
NO INDENT
Specifies no indentation.
INDENT [SIZE = integer]
Specifies indentation and the amount of indentation. The default size is 4.