Attention: Serialization is performed based on the SQL/XML
serialization rules. These rules, combined with the fact that
Derby supports
only a subset of the XMLSERIALIZE syntax, dictate that the results of an XMLSERIALIZE
operation are not guaranteed to be in-tact copies of the original XML text.
For example, assume that
[xString] is a textual representation
of a well-formed XML document. You issue the following statements:
INSERT INTO x_table (id, xcol)
VALUES (3, XMLPARSE(DOCUMENT '[xString]' PRESERVE WHITESPACE));
SELECT id, XMLSERIALIZE(xcol AS VARCHAR(100))
FROM x_table WHERE id = 3;
There is no guarantee that the result of the XMLSERIALIZE operator
will be identical to the original [xString] representation.
Certain transformations can occur as part of XMLSERIALIZE processing, and
those transformations are defined in the SQL/XML specification. In some cases
the result of XMLSERIALIZE might actually be the same as the original textual
representation, but that is not guaranteed.
When an XMLSERIALIZE operator
is specified as part of the top-level result set for a query, the result can
be accessed from JDBC by using whatever JDBC getXXX methods are allowed on
the string-data-type argument that is included in the XMLSERIALIZE
syntax. If you attempt to select the contents of an XML value from a top-level
result set without using the XMLSERIALIZE operator, Derby throws
an error. Derby does not
implicitly serialize XML values.