//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2018 Saxonica Limited. // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// package net.sf.saxon.s9api; import net.sf.saxon.Configuration; import net.sf.saxon.event.PipelineConfiguration; import net.sf.saxon.query.XQueryExpression; import net.sf.saxon.trace.ExpressionPresenter; import net.sf.saxon.trans.XPathException; /** * An XQueryExecutable represents the compiled form of a query. * To execute the query, it must first be loaded to form an {@link net.sf.saxon.s9api.XQueryEvaluator}. *
An XQueryExecutable is immutable, and therefore thread-safe. * It is simplest to load a new XQueryEvaluator each time the query is to be run. * However, the XQueryEvaluator is serially reusable within a single thread.
*An XQueryExecutable is created by using one of the compile methods on the
* {@link net.sf.saxon.s9api.XQueryCompiler} class.
The detailed form of this representation is not stable (or even documented).
* * @param destination the destination for the XML document containing the diagnostic representation * of the compiled stylesheet * @since 9.6 */ public void explain(Destination destination) throws SaxonApiException { Configuration config = processor.getUnderlyingConfiguration(); try { PipelineConfiguration pipe = config.makePipelineConfiguration(); exp.explain(new ExpressionPresenter(config, destination.getReceiver(pipe, config.obtainDefaultSerializationProperties()))); } catch (XPathException e) { throw new SaxonApiException(e); } } /** * Get the underlying implementation object representing the compiled stylesheet. This provides * an escape hatch into lower-level APIs. The object returned by this method may change from release * to release. * * @return the underlying implementation of the compiled stylesheet */ public XQueryExpression getUnderlyingCompiledQuery() { return exp; } }