Class QueryResult


  • public class QueryResult
    extends java.lang.Object
    This utility class takes the result sequence produced by a query, and wraps it as an XML document. The class is never instantiated.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String RESULT_NS  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void sendWrappedSequence​(SequenceIterator iterator, Receiver destination)
      Take a sequence supplied in the form of an iterator and generate a wrapped represention of the items in the sequence, the wrapped representation being a sequence of events sent to a supplied Receiver.
      static void serialize​(NodeInfo node, javax.xml.transform.Result destination, java.util.Properties outputProperties, Configuration config)
      Serialize a document containing wrapped query results (or any other document, in fact) as XML.
      static void serializeSequence​(SequenceIterator results, Configuration config, java.io.OutputStream destination, java.util.Properties outputProps)
      Serialize an arbitrary sequence, without any special wrapping.
      static void serializeSequence​(SequenceIterator results, Configuration config, java.io.PrintWriter writer, java.util.Properties outputProps)
      Serialize an arbitrary sequence, without any special wrapping.
      static DocumentInfo wrap​(SequenceIterator iterator, Configuration config)
      Take the results of a query (or any other SequenceIterator) and create an XML document containing copies of all items in the sequence, suitably wrapped
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • RESULT_NS

        public static java.lang.String RESULT_NS
    • Method Detail

      • wrap

        public static DocumentInfo wrap​(SequenceIterator iterator,
                                        Configuration config)
                                 throws XPathException
        Take the results of a query (or any other SequenceIterator) and create an XML document containing copies of all items in the sequence, suitably wrapped
        Parameters:
        iterator - The values to be wrapped
        config - The Saxon configuration used to evaluate the query
        Returns:
        the document containing the wrapped results
        Throws:
        XPathException
      • sendWrappedSequence

        public static void sendWrappedSequence​(SequenceIterator iterator,
                                               Receiver destination)
                                        throws XPathException
        Take a sequence supplied in the form of an iterator and generate a wrapped represention of the items in the sequence, the wrapped representation being a sequence of events sent to a supplied Receiver.
        Parameters:
        iterator - the input sequence
        destination - the Receiver to accept the wrapped output
        Throws:
        XPathException
      • serialize

        public static void serialize​(NodeInfo node,
                                     javax.xml.transform.Result destination,
                                     java.util.Properties outputProperties,
                                     Configuration config)
                              throws XPathException
        Serialize a document containing wrapped query results (or any other document, in fact) as XML.
        Parameters:
        node - The document or element to be serialized
        destination - The Result object to contain the serialized form
        outputProperties - Serialization options
        config - The Configuration
        Throws:
        XPathException - If serialization fails
      • serializeSequence

        public static void serializeSequence​(SequenceIterator results,
                                             Configuration config,
                                             java.io.OutputStream destination,
                                             java.util.Properties outputProps)
                                      throws XPathException
        Serialize an arbitrary sequence, without any special wrapping.
        Parameters:
        results - the sequence to be serialized
        config - the configuration (gives access to information such as the NamePool)
        destination - the output stream to which the output is to be written
        outputProps - a set of serialization properties as defined in JAXP
        Throws:
        XPathException - if any failure occurs
      • serializeSequence

        public static void serializeSequence​(SequenceIterator results,
                                             Configuration config,
                                             java.io.PrintWriter writer,
                                             java.util.Properties outputProps)
                                      throws XPathException
        Serialize an arbitrary sequence, without any special wrapping.
        Parameters:
        results - the sequence to be serialized
        config - the configuration (gives access to information such as the NamePool)
        writer - the writer to which the output is to be written
        outputProps - a set of serialization properties as defined in JAXP
        Throws:
        XPathException - if any failure occurs