com.saxonica.expr.ee
Class StaticQueryContextEE

java.lang.Object
  extended by net.sf.saxon.query.StaticQueryContext
      extended by com.saxonica.expr.ee.StaticQueryContextEE

public class StaticQueryContextEE
extends StaticQueryContext

A version of StaticQueryContext for Saxon-EE, that extends the capability by allowing compilation of library modules.


Constructor Summary
StaticQueryContextEE(Configuration config)
          Create a StaticQueryContext using a given Configuration.
 
Method Summary
 void compileLibrary(InputStream source, String encoding)
          Prepare an XQuery library module for subsequent evaluation.
 void compileLibrary(Reader source)
          Prepare an XQuery library module for subsequent evaluation.
 void compileLibrary(String query)
          Compile an XQuery library module for subsequent evaluation.
 QueryLibrary getCompiledLibrary(String namespace)
          Get a previously compiled library module
 
Methods inherited from class net.sf.saxon.query.StaticQueryContext
buildDocument, clearDeclaredGlobalVariables, clearNamespaces, clearPassiveNamespaces, compileQuery, compileQuery, compileQuery, declareCollation, declareCollation, declareDefaultCollation, declareGlobalVariable, declareNamespace, declarePassiveNamespace, getAllCollations, getBaseURI, getCollation, getCollationMap, getConfiguration, getConstructionMode, getDefaultCollationName, getDefaultElementNamespace, getDefaultFunctionNamespace, getErrorListener, getExecutable, getExternalNamespaceResolver, getLanguageVersion, getModuleURIResolver, getNamePool, getNamespaceForPrefix, getRequiredContextItemType, getSystemId, getUserDeclaredNamespaces, isCompileWithTracing, isEmptyLeast, isGeneratingJavaCode, isInheritNamespaces, isPreserveBoundarySpace, isPreserveNamespaces, isSchemaAware, isUpdating, isUpdatingEnabled, iterateDeclaredGlobalVariables, iterateDeclaredPrefixes, reset, setBaseURI, setCompileWithTracing, setConfiguration, setConstructionMode, setDefaultElementNamespace, setDefaultFunctionNamespace, setEmptyLeast, setErrorListener, setExternalNamespaceResolver, setGeneratingJavaCode, setInheritNamespaces, setLanguageVersion, setModuleURIResolver, setPreserveBoundarySpace, setPreserveNamespaces, setRequiredContextItemType, setSchemaAware, setUpdatingEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticQueryContextEE

public StaticQueryContextEE(Configuration config)
Create a StaticQueryContext using a given Configuration. This creates a StaticQueryContext for a main module (that is, a module that is not a library module).

Parameters:
config - the Saxon Configuration
Since:
9.2
Method Detail

compileLibrary

public void compileLibrary(String query)
                    throws XPathException
Compile an XQuery library module 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.

Note that this interface makes the caller responsible for decoding the query and presenting it as a string of characters. This means it is likely that any encoding specified in the query prolog will be ignored.

Overrides:
compileLibrary in class StaticQueryContext
Parameters:
query - The XQuery library module to be compiled, supplied as a string.
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.
Since:
9.2 (changed in 9.3 to return void)

compileLibrary

public void compileLibrary(Reader source)
                    throws XPathException,
                           IOException
Prepare an XQuery library module 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. The effect of the method is that subsequent query compilations using this static context can import the module URI without specifying a location hint; the import then takes effect without requiring the module to be compiled each time it is imported.

Note that this interface makes the Reader responsible for decoding the query and presenting it as a stream of characters. This means it is likely that any encoding specified in the query prolog will be ignored. Also, some implementations of Reader cannot handle a byte order mark.

Overrides:
compileLibrary in class StaticQueryContext
Parameters:
source - A Reader giving access to the text of the XQuery query to be compiled.
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.
IOException - if a failure occurs reading the supplied input.
Since:
9.2 (changed in 9.3 to return void)

compileLibrary

public void compileLibrary(InputStream source,
                           String encoding)
                    throws XPathException,
                           IOException
Prepare an XQuery library module for subsequent evaluation. The Query is supplied in the form of a InputStream, with an optional encoding. If the encoding is not specified, the query parser attempts to obtain the encoding by inspecting the input stream: it looks specifically for a byte order mark, and for the encoding option in the version declaration of an XQuery prolog. The effect of the method is that subsequent query compilations using this static context can import the module URI without specifying a location hint; the import then takes effect without requiring the module to be compiled each time it is imported. The encoding defaults to UTF-8. The base URI of the query is taken from the static context, and defaults to the current working directory.

Overrides:
compileLibrary in class StaticQueryContext
Parameters:
source - An InputStream giving access to the text of the XQuery query to be compiled, as a stream of octets
encoding - The encoding used to translate characters to octets in the query source. The parameter may be null: in this case the query parser attempts to infer the encoding by inspecting the source, and if that fails, it assumes UTF-8 encoding
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.
IOException - if a failure occurs reading the supplied input.
Since:
9.2 (changed in 9.3 to return void)

getCompiledLibrary

public QueryLibrary getCompiledLibrary(String namespace)
Get a previously compiled library module

Overrides:
getCompiledLibrary in class StaticQueryContext
Parameters:
namespace - the module namespace
Returns:
the QueryLibrary if a module with this namespace has been compiled as a library module; otherwise null.
Since:
9.3


Copyright (c) 2004-2010 Saxonica Limited. All rights reserved.