Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.saxon.query
Class QueryProcessor

    java.lang.Object
      net.sf.saxon.query.QueryProcessor

Deprecated. since Saxon 8.1: use methods on the StaticQueryContext directly

public class QueryProcessor
extends java.lang.Object

A QueryProcessor allows the compilation of XQuery queries for subsequent execution. Compilation consists of parsing, static analysis, optimization, and creation of an internal representation of the query for subsequent evaluation.

The compilation of a query takes context information from a static context, which is represented by a StaticQueryContext object. This provides the necessary information about collations, base URI, etc.

This class is retained for backwards compatibility, but there is no longer any need for applications to use it directly, since all its methods are available directly from the StaticQueryContext object.

Constructor Summary
`QueryProcessor(StaticQueryContext env)` Deprecated. since Saxon 8.1: use methods on the StaticQueryContext directly

Method Summary
`DocumentInfo` | `buildDocument(javax.xml.transform.Source source)` Deprecated. Convenience method for building Saxon's internal representation of a source XML document.
`XQueryExpression` | `compileQuery(java.io.Reader source)` Deprecated. Prepare an XQuery query for subsequent evaluation.
`XQueryExpression` | `compileQuery(java.lang.String query)` Deprecated. Prepare an XQuery query for subsequent evaluation.
`Configuration` | `getConfiguration()` Deprecated. Get the configuration used by this QueryProcessor
`StaticQueryContext` | `getStaticContext()` Deprecated. Get the current static context
`void` | `setConfiguration(Configuration config)` Deprecated. Set the configuration.
`void` | `setStaticContext(StaticQueryContext context)` Deprecated. Set the static context for compiling XQuery expressions.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### QueryProcessor

    public QueryProcessor(StaticQueryContext env)

  Deprecated. since Saxon 8.1: use methods on the StaticQueryContext directly

  Default constructor.

Parameters:
  `env` - the static context for queries. Note that a StaticQueryContext object may be initialized with context information that the query can use, but it is also modified when a query is compiled against it: for example, namespaces, variables, and functions declared in the query prolog are registered in the static context. Therefore, it is not a good idea to use a StaticQueryContext object to compile more than one query.

Method Detail

### buildDocument

    public DocumentInfo buildDocument(javax.xml.transform.Source source)
                               throws XPathException

  Deprecated.
  Convenience method for building Saxon's internal representation of a source XML document. The document will be built using the default NamePool, which means that any process that uses it must also use the default NamePool.

  Parameters:
    `source` - Any javax.xml.transform.Source object representing the document against which queries will be executed. Note that a Saxon `DocumentInfo` (indeed any `NodeInfo`) can be used as a Source. To use a third-party DOM Document as a source, create an instance of `DOMSource` to wrap it.

    For additional control over the way in which the source document is processed, supply an `AugmentedSource` object and set appropriate options on the object.

  Returns:
    the DocumentInfo representing the root node of the resulting document object.
  Throws:
    `XPathException`

### setStaticContext

    public void setStaticContext(StaticQueryContext context)

  Deprecated.
  Set the static context for compiling XQuery expressions. This provides control over the environment in which the query is compiled, for example it allows namespace prefixes to be declared, variables to be bound and functions to be defined. For most purposes, the static context can be defined by providing and tailoring an instance of the StandaloneContext class. Until this method is called, a default query context is used, in which no namespaces are defined other than the standard ones (xml, xslt, and saxon), and no variables or functions (other than the core XPath functions) are available.

### getStaticContext

    public StaticQueryContext getStaticContext()

  Deprecated.
  Get the current static context

### setConfiguration

    public void setConfiguration(Configuration config)

  Deprecated.
  Set the configuration. The configuration contains parameters that affect the way the query is compiled and executed.

### getConfiguration

    public Configuration getConfiguration()

  Deprecated.
  Get the configuration used by this QueryProcessor

### compileQuery

    public XQueryExpression compileQuery(java.lang.String query)
                                  throws XPathException

  Deprecated.
  Prepare an XQuery query for subsequent evaluation. The source text of the query is supplied as a String. The base URI of the query is taken from the static context, and defaults to the current working directory.

  Parameters:
    `query` - The XQuery query to be evaluated, supplied as a string.
  Returns:
    an XQueryExpression object representing the prepared expression
  Throws:
    `XPathException` - if the syntax of the expression is wrong, or if it references namespaces, variables, or functions that have not been declared, or contains other static errors.

### compileQuery

    public XQueryExpression compileQuery(java.io.Reader source)
                                  throws XPathException,
                                         java.io.IOException

  Deprecated.
  Prepare an XQuery query for subsequent evaluation. The Query is supplied in the form of a Reader. The base URI of the query is taken from the static context, and defaults to the current working directory.

  Parameters:
    `source` - A Reader giving access to the text of the XQuery query to be compiled.
  Returns:
    an XPathExpression object representing the prepared expression.
  Throws:
    `XPathException` - if the syntax of the expression is wrong, or if it references namespaces, variables, or functions that have not been declared, or any other static error is reported.
    `java.io.IOException` - if a failure occurs reading the supplied input.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD