<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>XQueryEvaluator</title> <meta name="keywords" content="Saxon.Api.XQueryEvaluator class"> <link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style"> </head> <body> <div style="width:20%; float:left; background-color:#c1cede; overflow:auto; height:100%"> <h2>Saxon.Api</h2> <div style="position:relative; height:4pt"> <p>Class <a href="DocumentBuilder.html">DocumentBuilder</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="DomDestination.html">DomDestination</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="DynamicContext.html">DynamicContext</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="DynamicError.html">DynamicError</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="EmptyEnumerator.html">EmptyEnumerator</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="ExtensionFunctionCall.html">ExtensionFunctionCall</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="ExtensionFunctionDefinition.html">ExtensionFunctionDefinition</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="NullDestination.html">NullDestination</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="Processor.html">Processor</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="QName.html">QName</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="SchemaManager.html">SchemaManager</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="SchemaValidator.html">SchemaValidator</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="Serializer.html">Serializer</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="StaticContext.html">StaticContext</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="StaticError.html">StaticError</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="TextWriterDestination.html">TextWriterDestination</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XPathCompiler.html">XPathCompiler</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XPathExecutable.html">XPathExecutable</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XPathSelector.html">XPathSelector</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XQueryCompiler.html">XQueryCompiler</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XQueryEvaluator.html">XQueryEvaluator</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XQueryExecutable.html">XQueryExecutable</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmAnyFunctionType.html">XdmAnyFunctionType</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmAnyItemType.html">XdmAnyItemType</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmAnyNodeType.html">XdmAnyNodeType</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmAtomicType.html">XdmAtomicType</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmAtomicValue.html">XdmAtomicValue</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmDestination.html">XdmDestination</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmEmptySequence.html">XdmEmptySequence</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmFunctionItem.html">XdmFunctionItem</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmItem.html">XdmItem</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmItemType.html">XdmItemType</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmNode.html">XdmNode</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmNodeKind.html">XdmNodeKind</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmSequenceType.html">XdmSequenceType</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmValue.html">XdmValue</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XmlDestination.html">XmlDestination</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XsltCompiler.html">XsltCompiler</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XsltExecutable.html">XsltExecutable</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XsltTransformer.html">XsltTransformer</a></p> </div> <div style="position:relative; height:4pt"> <p>Enum <a href="RecoveryPolicy.html">RecoveryPolicy</a></p> </div> <div style="position:relative; height:4pt"> <p>Enum <a href="SchemaValidationMode.html">SchemaValidationMode</a></p> </div> <div style="position:relative; height:4pt"> <p>Enum <a href="TreeModel.html">TreeModel</a></p> </div> <div style="position:relative; height:4pt"> <p>Enum <a href="WhitespacePolicy.html">WhitespacePolicy</a></p> </div> <div style="position:relative; height:4pt"> <p>Enum <a href="XdmAxis.html">XdmAxis</a></p> </div> <div style="position:relative; height:4pt"> <p>Interface <a href="IMessageListener.html">IMessageListener</a></p> </div> <div style="position:relative; height:4pt"> <p>Interface <a href="IQueryResolver.html">IQueryResolver</a></p> </div> <div style="position:relative; height:4pt"> <p>Interface <a href="IResultDocumentHandler.html">IResultDocumentHandler</a></p> </div> <div style="position:relative; height:4pt"> <p>Interface <a href="IXdmEnumerator.html">IXdmEnumerator</a></p> </div> <div style="position:relative; height:4pt"> <p>Interface <a href="IXmlLocation.html">IXmlLocation</a></p> </div> <div style="position:relative; height:4pt"> <p>Interface <a href="SchemaResolver.html">SchemaResolver</a></p> </div> </div> <div style="width:5%; float:left; background-color:#e4eef0; overflow:auto; height:100%"> </div> <div style="float:left; width:75%; overflow:auto; height:100%;"> <h2><font size="-1">Saxon.Api</font><br>Class XQueryEvaluator </h2> <hr> <dl> <dt><pre>public class XQueryEvaluator</pre></dt> <dt> implements IEnumerable</dt> </dl> <dl> <dd> <p> An <code>XQueryEvaluator</code> represents a compiled and loaded query ready for execution. The <code>XQueryEvaluator</code> holds details of the dynamic evaluation context for the query. </p> <p>An <code>XQueryEvaluator</code> should not be used concurrently in multiple threads. It is safe, however, to reuse the object within a single thread to run the same query several times. Running the query does not change the context that has been established. </p> <p>An <code>XQueryEvaluator</code> is always constructed by running the <code>Load</code> method of an <code>XQueryExecutable</code>. </p> </dd> </dl> <hr><a name="property_summary"></a><table border="1" width="100%" cellpadding="3" cellspacing="0" summary=""> <tr border="#ccccff" class="TableHeadingColor"> <th align="left" colspan="2"><font size="+2"><b>Property Summary</b></font></th> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> <a href="XdmItem.html">XdmItem</a></code></td> <td><code><b><a href="#ContextItem">ContextItem</a></b></code><p> The context item for the query. </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> <a href="SchemaValidationMode.html">SchemaValidationMode</a></code></td> <td><code><b><a href="#SchemaValidationMode">SchemaValidationMode</a></b></code><p> The <code>SchemaValidationMode</code> to be used in this transformation, especially for documents loaded using the <code>doc()</code>, <code>document()</code>, or <code>collection()</code> functions. </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> XmlResolver</code></td> <td><code><b><a href="#InputXmlResolver">InputXmlResolver</a></b></code><p> The <code>XmlResolver</code> to be used at run-time to resolve and dereference URIs supplied to the <code>doc()</code> function. </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> Stream</code></td> <td><code><b><a href="#TraceFunctionDestination">TraceFunctionDestination</a></b></code> Destination for output of messages produced using <trace()>. <p>If no specific destination is supplied by the caller, message information will be written to the standard error stream. </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> DynamicQueryContext</code></td> <td><code><b><a href="#Implementation">Implementation</a></b></code><p> Escape hatch to the <code>net.sf.saxon.query.DynamicQueryContext</code> object in the underlying Java implementation </p> </td> </tr> </table> <a name="method_summary"></a><table border="1" width="100%" cellpadding="3" cellspacing="0" summary=""> <tr border="#ccccff" class="TableHeadingColor"> <th align="left" colspan="2"><font size="+2"><b>Method Summary</b></font></th> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> void</code></td> <td><code><b><a href="#SetExternalVariable(Saxon.Api.QName,Saxon.Api.XdmValue)">SetExternalVariable</a></b>(<a href="QName.html">QName</a> name, <a href="XdmValue.html">XdmValue</a> value)</code><p> Set the value of an external variable declared in the query. </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> <a href="XdmValue.html">XdmValue</a></code></td> <td><code><b><a href="#Evaluate()">Evaluate</a></b>()</code><p> Evaluate the query, returning the result as an <code>XdmValue</code> (that is, a sequence of nodes and/or atomic values). </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> <a href="XdmItem.html">XdmItem</a></code></td> <td><code><b><a href="#EvaluateSingle()">EvaluateSingle</a></b>()</code><p> Evaluate the query, returning the result as an <code>XdmItem</code> (that is, a single node or atomic value). </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> <a href="http://msdn.microsoft.com/en-us/library/system.collections.ienumerator(VS.80).aspx">IEnumerator</a></code></td> <td><code><b><a href="#GetEnumerator()">GetEnumerator</a></b>()</code><p> Evaluate the query, returning the result as an <code>IEnumerator</code> (that is, an enumerator over a sequence of nodes and/or atomic values). </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> void</code></td> <td><code><b><a href="#Run(Saxon.Api.XmlDestination)">Run</a></b>(<a href="XmlDestination.html">XmlDestination</a> destination)</code><p> Evaluate the query, sending the result to a specified destination. </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> XdmNode[]</code></td> <td><code><b><a href="#RunUpdate()">RunUpdate</a></b>()</code><p> Execute an updating query. </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> <a href="XdmValue.html">XdmValue</a></code></td> <td><code><b><a href="#CallFunction(Saxon.Api.QName,Saxon.Api.XdmValue[])">CallFunction</a></b>(<a href="QName.html">QName</a> function, Saxon.Api.XdmValue[] arguments)</code><p> Call a global user-defined function in the compiled query. </p> </td> </tr> </table> <a name="property_detail"></a><table border="1" width="100%" cellpadding="3" cellspacing="0" summary=""> <tr border="#ccccff" class="TableHeadingColor"> <th align="left" colspan="2"><font size="+2"><b>Property Detail</b></font></th> </tr> </table><a name="ContextItem"></a><h3>ContextItem</h3><pre>public <a href="XdmItem.html">XdmItem</a> <b>ContextItem</b> {get; set; }</pre><dl> <dd> <p> The context item for the query. </p> <p> This may be either a node or an atomic value. Most commonly it will be a document node, which might be constructed using the <code>LoadDocument</code> method of the <code>Processor</code> object. </p> </dd> </dl> <hr><a name="SchemaValidationMode"></a><h3>SchemaValidationMode</h3><pre>public <a href="SchemaValidationMode.html">SchemaValidationMode</a> <b>SchemaValidationMode</b> {get; set; }</pre><dl> <dd> <p> The <code>SchemaValidationMode</code> to be used in this transformation, especially for documents loaded using the <code>doc()</code>, <code>document()</code>, or <code>collection()</code> functions. </p> </dd> </dl> <hr><a name="InputXmlResolver"></a><h3>InputXmlResolver</h3><pre>public XmlResolver <b>InputXmlResolver</b> {get; set; }</pre><dl> <dd> <p> The <code>XmlResolver</code> to be used at run-time to resolve and dereference URIs supplied to the <code>doc()</code> function. </p> </dd> </dl> <hr><a name="TraceFunctionDestination"></a><h3>TraceFunctionDestination</h3><pre>public Stream <b>TraceFunctionDestination</b> {get; set; }</pre><dl> <dd> Destination for output of messages produced using <trace()>. <p>If no specific destination is supplied by the caller, message information will be written to the standard error stream. </p> <p>The supplied destination is ignored if a <code>TraceListener</code> is in use. </p> <p> <i>Property added in Saxon 9.1</i> </p> </dd> </dl> <hr><a name="Implementation"></a><h3>Implementation</h3><pre>public DynamicQueryContext <b>Implementation</b> {get; }</pre><dl> <dd> <p> Escape hatch to the <code>net.sf.saxon.query.DynamicQueryContext</code> object in the underlying Java implementation </p> </dd> </dl> <hr><a name="method_detail"></a><table border="1" width="100%" cellpadding="3" cellspacing="0" summary=""> <tr border="#ccccff" class="TableHeadingColor"> <th align="left" colspan="2"><font size="+2"><b>Method Detail</b></font></th> </tr> </table><a name="SetExternalVariable(Saxon.Api.QName,Saxon.Api.XdmValue)"></a><h3>SetExternalVariable</h3><pre>public void <b>SetExternalVariable</b>(<a href="QName.html">QName</a> name, <a href="XdmValue.html">XdmValue</a> value)</pre><dl> <dd> <p> Set the value of an external variable declared in the query. </p><b>Parameters:</b><dl> <dt><code>name</code> - </dt> <dd>The name of the external variable, expressed as a QName. If an external variable of this name has been declared in the query prolog, the given value will be assigned to the variable. If the variable has not been declared, calling this method has no effect (it is not an error). </dd> </dl> <dl> <dt><code>value</code> - </dt> <dd>The value to be given to the external variable. If the variable declaration defines a required type for the variable, then this value must match the required type: no conversions are applied. </dd> </dl> </dd> </dl> <hr><a name="Evaluate()"></a><h3>Evaluate</h3><pre>public <a href="XdmValue.html">XdmValue</a> <b>Evaluate</b>()</pre><dl> <dd> <p> Evaluate the query, returning the result as an <code>XdmValue</code> (that is, a sequence of nodes and/or atomic values). </p> <dl> <dt>returns</dt> <dd> An <code>XdmValue</code> representing the results of the query </dd> </dl> </dd> </dl> <hr><a name="EvaluateSingle()"></a><h3>EvaluateSingle</h3><pre>public <a href="XdmItem.html">XdmItem</a> <b>EvaluateSingle</b>()</pre><dl> <dd> <p> Evaluate the query, returning the result as an <code>XdmItem</code> (that is, a single node or atomic value). </p> <dl> <dt>returns</dt> <dd> An <code>XdmItem</code> representing the result of the query, or null if the query returns an empty sequence. If the query returns a sequence of more than one item, any items after the first are ignored. </dd> </dl> </dd> </dl> <hr><a name="GetEnumerator()"></a><h3>GetEnumerator</h3><pre>public <a href="http://msdn.microsoft.com/en-us/library/system.collections.ienumerator(VS.80).aspx">IEnumerator</a> <b>GetEnumerator</b>()</pre><dl> <dd> <p> Evaluate the query, returning the result as an <code>IEnumerator</code> (that is, an enumerator over a sequence of nodes and/or atomic values). </p> <dl> <dt>returns</dt> <dd> An enumerator over the sequence that represents the results of the query. Each object in this sequence will be an instance of <code>XdmItem</code>. Note that the query may be evaluated lazily, which means that a successful response from this method does not imply that the query has executed successfully: failures may be reported later while retrieving items from the iterator. </dd> </dl> </dd> </dl> <hr><a name="Run(Saxon.Api.XmlDestination)"></a><h3>Run</h3><pre>public void <b>Run</b>(<a href="XmlDestination.html">XmlDestination</a> destination)</pre><dl> <dd> <p> Evaluate the query, sending the result to a specified destination. </p><b>Parameters:</b><dl> <dt><code>destination</code> - </dt> <dd> The destination for the results of the query. The class <code>XmlDestination</code> is an abstraction that allows a number of different kinds of destination to be specified. </dd> </dl> </dd> </dl> <hr><a name="RunUpdate()"></a><h3>RunUpdate</h3><pre>public XdmNode[] <b>RunUpdate</b>()</pre><dl> <dd> <p> Execute an updating query. </p> <dl> <dt>returns</dt> <dd>An array containing the root nodes of documents that have been updated by the query. </dd> </dl> </dd> </dl> <hr><a name="CallFunction(Saxon.Api.QName,Saxon.Api.XdmValue[])"></a><h3>CallFunction</h3><pre>public <a href="XdmValue.html">XdmValue</a> <b>CallFunction</b>(<a href="QName.html">QName</a> function, Saxon.Api.XdmValue[] arguments)</pre><dl> <dd> <p> Call a global user-defined function in the compiled query. </p> <p> If this is called more than once (to evaluate the same function repeatedly with different arguments, or to evaluate different functions) then the sequence of evaluations uses the same values of global variables including external variables (query parameters); the effect of any changes made to query parameters between calls is undefined. </p><b>Parameters:</b><dl> <dt><code>function</code> - </dt> <dd> The name of the function to be called </dd> </dl> <dl> <dt><code>arguments</code> - </dt> <dd> The values of the arguments to be supplied to the function. These must be of the correct type as defined in the function signature (there is no automatic conversion to the required type). </dd> </dl> </dd> </dl> <hr> </div> </body> </html>