DB2 10.5 for Linux, UNIX, and Windows

Serialization of the XDM

The result of an XQuery expression, which is an instance of the XDM, can be transformed into an XML representation through a process called serialization.

During serialization, the sequence of nodes and atomic values (the instance of the XDM) is converted into an XML representation. The result of serialization does not always represent a well-formed document. In fact, serialization can result in a single atomic value (for example, 17) or a sequence of elements that do not have a common parent.

XQuery does not provide a function to serialize the XDM. How the XDM is serialized into XML data depends on the environment in which the query is executing. For example, the CLP (command-line processor) returns a sequence of serialized items with each serialized item returned as a row in the result. For example, the query XQUERY (1, 2, 3), when entered from the CLP, returns the following result:
1
2
3

Serialization can also be performed by the SQL/XML function XMLSERIALIZE.