The XQL character processing engine now supports storage and querying of XML documents containing strings in native character sets.
The XML parser accepts XML documents as a stream of bytes containing characters in native code sets. The XML parsing engine accepts XML documents as either java.io.InputStream or as java.lang.String. The XML parser checks XML documents and indexes the XML document in any language or character set the XML standard supports.
The query engine parses queries made against the XML document, processes them, and returns query results as java.lang.String, which is Unicode. You can use the XQL engine either as part of Adaptive Server or as a standalone engine.
The processing engine returns results as java.lang.String, which is Unicode. You should then convert the results of your query from Java strings back to your native code set.
The query engine allows you to:
Set the character set encoding. The XQL query engine in Adaptive Server mode processes documents whose character set encoding is the same as the character set of the Adaptive Server. If you use the query engine in a standalone server, character set encoding is set using the Java method com.sybase.xml.xql.Xql.setEncoding().
com.sybase.xml.xql.Xql.setEncoding() is not supported in Adaptive Server. Use it only in standalone mode.
Parse your XML document. Your XML document heading specifies the native character set of the data you enter, in java.lang.String or java.io.InputStream. The parser generates events while it parses an XML document. These events pass their information to the indexing layer as java.lang.String.
The new flexibility of the query engine requires no change in your parsing process if you use the Xerces parser. If you use a different parser, make sure your parser supports the native character set encoding of your XML document, which is specified in the encoding directive of the XML document heading.
Query. The XQL query engine accepts queries as java.io.InputStream or java.lang.String. The java.io.InputStream parameter allows character set queries to be fed into the query parser without conversion.
Internally, the query engine translates the incoming stream of bytes to Unicode, using either the character encoding of Adaptive Server, or com.sybase.xml.xql.Xql.setEncoding() in standalone mode.
Obtain results. You can use the sample code provided in this document to convert the results of your query from java.lang.string back to native code sets.