|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.saxon.s9api.XQueryEvaluator
public class XQueryEvaluator
An XQueryEvaluator
represents a compiled and loaded stylesheet ready for execution.
The XQueryEvaluator
holds details of the dynamic evaluation context for the stylesheet.
An XQueryEvaluator
must not be used concurrently in multiple threads.
It is safe, however, to reuse the object within a single thread to run the same
stylesheet several times. Running the stylesheet does not change the context
that has been established.
An XQueryEvaluator
is always constructed by running the Load
method of an XQueryExecutable
.
An XQueryEvaluator
is itself a Iterable
. This makes it possible to
evaluate the results in a for-each expression.
Constructor Summary | |
---|---|
protected |
XQueryEvaluator(Processor processor,
XQueryExpression expression)
Protected constructor |
Method Summary | |
---|---|
XdmValue |
evaluate()
Perform the query, returning the results as an XdmValue. |
XdmItem |
getContextItem()
Get the initial context item for the query, if one has been set |
javax.xml.transform.ErrorListener |
getErrorListener()
Get the error listener. |
XdmValue |
getExternalVariable(QName name)
Get the value that has been set for an external variable |
java.io.PrintStream |
getTraceFunctionDestination()
Get the destination for output from the fn:trace() function. |
TraceListener |
getTraceListener()
Get the registered TraceListener, if any |
DynamicQueryContext |
getUnderlyingQueryContext()
Get the underlying dynamic context object. |
java.util.Iterator<XdmNode> |
getUpdatedDocuments()
After executing an updating query using the run() method, iterate over the root
nodes of the documents updated by the query. |
javax.xml.transform.URIResolver |
getURIResolver()
Get the URI resolver. |
java.util.Iterator<XdmItem> |
iterator()
Get an iterator over the results of the query. |
void |
run()
Perform the query. |
void |
run(Destination destination)
Perform the query, sending the results to a specified destination. |
void |
setContextItem(XdmItem item)
Set the initial context item for the query |
void |
setDestination(Destination destination)
Set the destination to be used for the query results |
void |
setErrorListener(javax.xml.transform.ErrorListener listener)
Set the error listener. |
void |
setExternalVariable(QName name,
XdmValue value)
Set the value of external variable defined in the query |
void |
setSource(javax.xml.transform.Source source)
Set the source document for the query. |
void |
setTraceFunctionDestination(java.io.PrintStream stream)
Set the destination for output from the fn:trace() function. |
void |
setTraceListener(TraceListener listener)
Set a TraceListener which will receive messages relating to the evaluation of all expressions. |
void |
setURIResolver(javax.xml.transform.URIResolver resolver)
Set an object that will be used to resolve URIs used in fn:doc() and related functions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected XQueryEvaluator(Processor processor, XQueryExpression expression)
processor
- the Saxon processorexpression
- the XQuery expressionMethod Detail |
---|
public void setSource(javax.xml.transform.Source source) throws SaxonApiException
source
- the principal source document for the transformation
SaxonApiException
public void setContextItem(XdmItem item)
item
- the initial context item, or null if there is to be no initial context itempublic XdmItem getContextItem()
public void setExternalVariable(QName name, XdmValue value)
name
- the name of the external variable, as a QNamevalue
- the value of the external variable, or null to clear a previously set valuepublic XdmValue getExternalVariable(QName name)
name
- the name of the external variable whose value is required
public void setURIResolver(javax.xml.transform.URIResolver resolver)
resolver
- An object that implements the URIResolver interface, or
null.public javax.xml.transform.URIResolver getURIResolver()
public void setErrorListener(javax.xml.transform.ErrorListener listener)
listener
- the ErrorListener to be usedpublic javax.xml.transform.ErrorListener getErrorListener()
public void setTraceListener(TraceListener listener)
listener
- the TraceListener to usepublic TraceListener getTraceListener()
public void setTraceFunctionDestination(java.io.PrintStream stream)
stream
- the PrintStream to which trace output will be sent. If set to
null, trace output is suppressed entirely. It is the caller's responsibility
to close the stream after use.public java.io.PrintStream getTraceFunctionDestination()
public void setDestination(Destination destination)
destination
- the destination to which the results of the query will be sentpublic void run() throws SaxonApiException
getUpdatedDocuments()
method.
SaxonApiException
- if any dynamic error occurs during the query
java.lang.IllegalStateException
- if this is a non-updating query and no Destination has been
supplied for the query resultspublic void run(Destination destination) throws SaxonApiException
destination
- The destination where the result document will be sent
SaxonApiException
- if any dynamic error occurs during the query
java.lang.IllegalStateException
- if this is an updating querypublic XdmValue evaluate() throws SaxonApiException
SaxonApiException
- if the query fails with a dynamic error
java.lang.IllegalStateException
- if this is an updating querypublic java.util.Iterator<XdmItem> iterator() throws SaxonApiUncheckedException
iterator
in interface java.lang.Iterable<XdmItem>
SaxonApiUncheckedException
- if a dynamic error is detected while constructing the iterator.
It is also possible for an SaxonApiUncheckedException to be thrown by the hasNext() method of the
returned iterator if a dynamic error occurs while evaluating the result sequence.
java.lang.IllegalStateException
- if this is an updating querypublic java.util.Iterator<XdmNode> getUpdatedDocuments()
run()
method, iterate over the root
nodes of the documents updated by the query.
The results remain available until a new query is executed. This method returns the results of the most recently executed query. It does not consume the results.
public DynamicQueryContext getUnderlyingQueryContext()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |