|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sf.saxon.query.XQueryExpression
XQueryExpression represents a compiled query. This object is immutable and thread-safe, the same compiled query may be executed many times in series or in parallel. The object can be created only by using the compileQuery method of the QueryProcessor class.
Various methods are provided for evaluating the query, with different options for delivery of the results.
Constructor Summary | |
protected |
XQueryExpression(Expression exp,
Executable exec,
StaticQueryContext staticEnv,
Configuration config)
The constructor is protected, to ensure that instances can only be created using the compileQuery() methods of QueryProcessor |
Method Summary | |
java.util.List |
evaluate(DynamicQueryContext env)
Execute a the compiled Query, returning the results as a List. |
java.lang.Object |
evaluateSingle(DynamicQueryContext env)
Execute the compiled Query, returning the first item in the result. |
void |
explain(NamePool pool)
Diagnostic method: display a representation of the compiled query on the System.err output stream. |
Controller |
getController()
Get a controller that can be used to execute functions in this compiled query. |
SequenceIterator |
iterator(DynamicQueryContext env)
Get an iterator over the results of the expression. |
void |
run(DynamicQueryContext env,
javax.xml.transform.Result result,
java.util.Properties outputProperties)
Run the query, sending the results directly to a JAXP Result object. |
protected void |
setDocumentInstruction(DocumentInstr doc)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected XQueryExpression(Expression exp, Executable exec, StaticQueryContext staticEnv, Configuration config)
Method Detail |
protected void setDocumentInstruction(DocumentInstr doc)
public java.util.List evaluate(DynamicQueryContext env) throws javax.xml.transform.TransformerException
env
- Provides the dynamic query evaluation context
evaluate
method
of class XPathProcessor
javax.xml.transform.TransformerException
public java.lang.Object evaluateSingle(DynamicQueryContext env) throws javax.xml.transform.TransformerException
env
- Provides the dynamic query evaluation context
evaluate
method
javax.xml.transform.TransformerException
public SequenceIterator iterator(DynamicQueryContext env) throws javax.xml.transform.TransformerException
To get the results of the query in the form of an XML document in which each item is wrapped by an element indicating its type, use:
QueryResult.wrap(iterator(env))
To serialize the results to a file, use the QueryResult.serialize() method.
env
- Provides the dynamic query evaluation context
XPathException
- if a dynamic error occurs in evaluating the query. Some
dynamic errors will not be reported by this method, but will only be reported
when the individual items of the result are accessed using the returned iterator.
javax.xml.transform.TransformerException
public void run(DynamicQueryContext env, javax.xml.transform.Result result, java.util.Properties outputProperties) throws javax.xml.transform.TransformerException
env
- the dynamic query contextresult
- the destination for the results of the query. The query is effectively wrapped
in a document{} constructor, so that the items in the result are concatenated to form a single
document; this is then written to the requested Result destination, which may be (for example)
a DOMResult, a SAXResult, or a StreamResultoutputProperties
- Supplies serialization properties, in JAXP format, if the result is to
be serialized. This parameter can be defaulted to null.
javax.xml.transform.TransformerException
- if the query fails.public Controller getController()
StaticQueryContext.getUserDefinedFunction(java.lang.String, java.lang.String, int)
.
They can then be called directly from the Java application using UserFunction.call(net.sf.saxon.value.Value[], net.sf.saxon.Controller, boolean)
The same Controller can be used for a series of function calls.
public void explain(NamePool pool)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |