|Built-in Functions / Standard Built-in Functions|
XMLSERIALIZE is a SQL/XML operator that you can use to convert an XML type to a character type. There is no other way to convert the type of a GemFire XD XML value.
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, GemFire XD throws an error. GemFire XD does not implicitly serialize XML values.
XMLSERIALIZE ( xml-value-expression AS string-data-type )
SELECT ID, XMLSERIALIZE( xcol AS CLOB) FROM x_tableTo retrieve the results from JDBC, you can use the JDBC getCharacterStream() or getString() method.
SELECT ID, XMLSERIALIZE( XMLQUERY('//student[@age>20]' PASSING BY REF xcol EMPTY ON EMPTY) AS VARCHAR(50)) FROM x_table
GemFire XD requires that a JAXP parser (such as Apache Xerces) and Apache Xalan are listed in the Java classpath for the XML functions to work. If either the JAXP parser or Xalan is missing from the classpath, attempts to use the XMLSERIALIZE operator will result in an error. In some situations, you may need to take steps to place the parser and Xalan in your classpath. See XML for details.