Accessing XML Results


You can access XML results of a query as:

For examples showing how to access XML results, see Returning Results with Java XML APIs.

DOM

The DOM nodes returned from XML results are DOM Level 2 Core API compliant.

SAX

DataDirect XQuery serializes a result sequence or a single item as SAX events in the following way:

  1. The instance of the data model is normalized as described in: http://www.w3.org/TR/2005/CR-xslt-xquery-serialization-20050404/#serdm
  2. The normalization process results in one of the following:
  3. Events are generated as defined by the SAX2 specification.

DataDirect XQuery reports comment nodes to the specified ContentHandler if that object also implements the LexicalHandler interface.

StAX

DataDirect XQuery serializes a result sequence or a single item as StAX events in the following way:

  1. The instance of the data model is normalized as described in :http://www.w3.org/TR/2005/CR-xslt-xquery-serialization-20050404/#serdm
  2. The normalization process results in one of the following:
  3. Events are generated as defined by the StAX 1.0 specification.

Text

DataDirect XQuery supports serializing query results (serialization refers to converting query results to text). The writeSequence and getSequenceAsString methods of the XQSequence interface allow you to serialize the results to the following Java objects: java.lang.String, java.io.Writer, and java.io.OutputStream. This serialization conforms to the process as described in the XSLT 2.0 and XQuery 1.0 Serialization specification, located at: http://www.w3.org/TR/2005/CR-xslt-xquery-serialization-20050404

See Serialization Support for more information.