/** * Protected constructor * @param expression the XQuery expression */ protected XQueryEvaluator(Processor processor, XQueryExpression expression) { this.processor = processor; this.expression = expression; this.context = new DynamicQueryContext(expression.getExecutable().getConfiguration()); }
logger.trace("getModuleFunctions.enter; got module: {}", module); XQueryExpression exp = getModuleExpression(module); List<String> result = lookupFunctions(exp.getExecutable().getFunctionLibrary(), new FunctionExtractor<String>() {
logger.trace("getRestFunctions.enter; got module: {}", module); XQueryExpression exp = getModuleExpression(module); List<Function> result = lookupFunctions(exp.getExecutable().getFunctionLibrary(), new FunctionExtractor<Function>() {
/** * Perform the query, sending the results to a previously specified destination * @throws net.sf.saxon.s9api.SaxonApiException if any dynamic error occurs during the query * @throws IllegalStateException if no Destination has been supplied for the query results */ public void run() throws SaxonApiException { try { expression.run(context, destination.getReceiver(expression.getExecutable().getConfiguration()), null); } catch (TransformerException e) { throw new SaxonApiException(e); } }
/** * Perform the query, sending the results to a specified destination * @param destination The destination where the result document will be sent * @throws net.sf.saxon.s9api.SaxonApiException if any dynamic error occurs during the query */ public void run(Destination destination) throws SaxonApiException { try { expression.run(context, destination.getReceiver(expression.getExecutable().getConfiguration()), null); } catch (TransformerException e) { throw new SaxonApiException(e); } }
/** * Set the initial context item for the query * * @param item the initial context item, or null if there is to be no initial context item * @throws SaxonApiException if the query declares the context item and does not define * it to be external */ public void setContextItem(XdmItem item) throws SaxonApiException { if (item != null) { GlobalContextRequirement gcr = expression.getExecutable().getGlobalContextRequirement(); if (gcr != null && !gcr.isExternal()) { throw new SaxonApiException("The context item for the query is not defined as external"); } context.setContextItem(item.getUnderlyingValue()); } }
/** * Set the initial context item for the query * * @param item the initial context item, or null if there is to be no initial context item * @throws SaxonApiException if the query declares the context item and does not define * it to be external */ public void setContextItem(XdmItem item) throws SaxonApiException { if (item != null) { GlobalContextRequirement gcr = expression.getExecutable().getGlobalContextRequirement(); if (gcr != null && !gcr.isExternal()) { throw new SaxonApiException("The context item for the query is not defined as external"); } context.setContextItem(item.getUnderlyingValue()); } }
private Receiver getDestinationReceiver(Destination destination) throws SaxonApiException { Executable exec = expression.getExecutable(); PipelineConfiguration pipe = expression.getConfiguration().makePipelineConfiguration(); Receiver out = destination.getReceiver(pipe, exec.getPrimarySerializationProperties()); if (Configuration.isAssertionsEnabled()) { return new RegularSequenceChecker(out); } else { return out; } }
/** * Diagnostic method: display a representation of the compiled query on the * selected output stream. * * @param out an ExpressionPresenter to which the XML representation of the compiled query * will be sent */ public void explain(/*@NotNull*/ ExpressionPresenter out) throws XPathException { out.startElement("query"); getExecutable().getKeyManager().exportKeys(out, null); getExecutable().explainGlobalVariables(out); mainModule.explainGlobalFunctions(out); out.startElement("body"); expression.export(out); out.endElement(); out.endElement(); out.close(); }
/** * Diagnostic method: display a representation of the compiled query on the * selected output stream. * * @param out an ExpressionPresenter to which the XML representation of the compiled query * will be sent */ public void explain(/*@NotNull*/ ExpressionPresenter out) throws XPathException { out.startElement("query"); getExecutable().getKeyManager().exportKeys(out, null); getExecutable().explainGlobalVariables(out); mainModule.explainGlobalFunctions(out); out.startElement("body"); expression.export(out); out.endElement(); out.endElement(); out.close(); }
private Receiver getDestinationReceiver(Destination destination) throws SaxonApiException { Executable exec = expression.getExecutable(); PipelineConfiguration pipe = expression.getConfiguration().makePipelineConfiguration(); Receiver out = destination.getReceiver(pipe, exec.getPrimarySerializationProperties()); if (Configuration.isAssertionsEnabled()) { return new RegularSequenceChecker(out); } else { return out; } }
SerializationProperties params = expression.getExecutable().getPrimarySerializationProperties(); Receiver receiver = destination.getReceiver(config.makePipelineConfiguration(), params); expression.runStreamed(context, source, receiver, null);
SerializationProperties params = expression.getExecutable().getPrimarySerializationProperties(); Receiver receiver = destination.getReceiver(config.makePipelineConfiguration(), params); expression.runStreamed(context, source, receiver, null);
exp.getUnderlyingCompiledQuery().getExecutable().getPrimarySerializationProperties().getProperties()); runUpdate(exp, evaluator, serializer); } else {
throw new XPathException("Cannot call iterator() on an updating query"); if (!env.getConfiguration().isCompatible(getExecutable().getConfiguration())) { throw new XPathException("The query must be compiled and executed under the same Configuration", SaxonErrorCode.SXXP0004); if (contextItem instanceof NodeInfo && ((NodeInfo)contextItem).getTreeInfo().isTyped() && !getExecutable().isSchemaAware()) { throw new XPathException("A typed input document can only be used with a schema-aware query");
throw new XPathException("Cannot call iterator() on an updating query"); if (!env.getConfiguration().isCompatible(getExecutable().getConfiguration())) { throw new XPathException("The query must be compiled and executed under the same Configuration", SaxonErrorCode.SXXP0004); if (contextItem instanceof NodeInfo && ((NodeInfo)contextItem).getTreeInfo().isTyped() && !getExecutable().isSchemaAware()) { throw new XPathException("A typed input document can only be used with a schema-aware query");
throw new XPathException("Cannot call run() on an updating query"); if (!env.getConfiguration().isCompatible(getExecutable().getConfiguration())) { throw new XPathException("The query must be compiled and executed under the same Configuration", SaxonErrorCode.SXXP0004); if (contextItem instanceof NodeInfo && ((NodeInfo) contextItem).getTreeInfo().isTyped() && !getExecutable().isSchemaAware()) { throw new XPathException("A typed input document can only be used with a schema-aware query");
final FunctionLibraryList aFuncLibList = exp.getExecutable ().getFunctionLibrary (); for (final FunctionLibrary aFuncLib : aFuncLibList.getLibraryList ())
final FunctionLibraryList aFuncLibList = exp.getExecutable ().getFunctionLibrary (); for (final FunctionLibrary aFuncLib : aFuncLibList.getLibraryList ())
throw new XPathException("Cannot call run() on an updating query"); if (!env.getConfiguration().isCompatible(getExecutable().getConfiguration())) { throw new XPathException("The query must be compiled and executed under the same Configuration", SaxonErrorCode.SXXP0004); if (contextItem instanceof NodeInfo && ((NodeInfo) contextItem).getTreeInfo().isTyped() && !getExecutable().isSchemaAware()) { throw new XPathException("A typed input document can only be used with a schema-aware query");