/** * Protected constructor * * @param processor the Saxon processor * @param expression the XQuery expression */ protected XQueryEvaluator(Processor processor, XQueryExpression expression) { this.processor = processor; this.expression = expression; this.context = new DynamicQueryContext(expression.getConfiguration()); }
private void parseDefaultCollation() throws XPathException { // <"default" "collation"> StringLiteral if (foundDefaultCollation) { grumble("default collation appears more than once", "XQST0038"); } foundDefaultCollation = true; nextToken(); expect(Token.STRING_LITERAL); String uri = uriLiteral(t.currentTokenValue); ((QueryModule) env).setDefaultCollationName(uri); nextToken(); }
private void parseDefaultCollation() throws XPathException { // <"default" "collation"> StringLiteral if (foundDefaultCollation) { grumble("default collation appears more than once", "XQST0038"); } foundDefaultCollation = true; nextToken(); expect(Token.STRING_LITERAL); String uri = URILiteral(t.currentTokenValue); ((QueryModule)env).setDefaultCollationName(uri); nextToken(); }
/** * Check that all the types used in the signature of an imported function * are available in the module of the caller of the function * @param fd the declaration of the imported function * @throws XPathException if an error is found */ public void checkImportedFunctionSignature(XQueryFunction fd) throws XPathException { checkImportedType(fd.getResultType(), fd); for (int a=0; a<fd.getNumberOfArguments(); a++) { SequenceType argType = fd.getArgumentTypes()[a]; checkImportedType(argType, fd); } }
/** * Set a user-defined ModuleURIResolver for resolving URIs used in <code>import module</code> * declarations in the XQuery prolog. * This will override any ModuleURIResolver that was specified as part of the configuration. * * @param resolver the ModuleURIResolver to be used */ public void setModuleURIResolver(ModuleURIResolver resolver) { env.setModuleURIResolver(resolver); }
/** * Run the query in pull mode. From Saxon 9.8 this method is identical to {@link #run(DynamicQueryContext, Result, Properties)} * * @param dynamicEnv the dynamic context for query evaluation * @param destination the Receiver to accept the query results *usually a serializer) * @throws XPathException if a dynamic error occurs during the evaluation * @deprecated since 9.8. */ public void pull(/*@NotNull*/ DynamicQueryContext dynamicEnv, /*@NotNull*/ Result destination, Properties outputProperties) throws XPathException { run(dynamicEnv, destination, outputProperties); }
/** * Factory method to make an XQueryExpression * * @param exp the expression forming the body of the query * @param mainModule the query module containing the expression * @param streaming true if streamed execution is requested * @return the XQueryExpression * @throws XPathException if an error occurs */ public XQueryExpression makeXQueryExpression(Expression exp, QueryModule mainModule, boolean streaming) throws XPathException { return new XQueryExpression(exp, mainModule, false); }
/** * Get the user-defined ModuleURIResolver for resolving URIs used in <code>import module</code> * declarations in the XQuery prolog; returns null if none has been explicitly set either * here or in the Saxon Configuration. * * @return the registered ModuleURIResolver */ /*@Nullable*/ public ModuleURIResolver getModuleURIResolver() { return env.getModuleURIResolver(); }
/** * Get the URI resolver. * * @return the user-supplied URI resolver if there is one, or the * system-defined one otherwise */ public URIResolver getURIResolver() { return context.getURIResolver(); }
/** * Get the error listener. * * @return the ErrorListener in use */ public ErrorListener getErrorListener() { return context.getErrorListener(); }
/** * Get the registered TraceListener, if any * * @return listener the TraceListener in use, or null if none has been set */ public TraceListener getTraceListener() { return context.getTraceListener(); }
/** * Get a SequenceWrapper, a class that serializes an XDM sequence with full annotation of item types, node kinds, * etc. There are variants for Saxon-HE and Saxon-PE * @param destination the place where the wrapped sequence will be sent * @return the new SequenceWrapper */ public SequenceWrapper newSequenceWrapper(Receiver destination) { return new SequenceWrapper(destination); }
/** * Set whether trace hooks are to be included in the compiled code. To use tracing, it is necessary * both to compile the code with trace hooks included, and to supply a TraceListener at run-time * * @param option true if trace code is to be compiled in, false otherwise */ public void setCompileWithTracing(boolean option) { env.setCompileWithTracing(option); }
private void reportError(/*@NotNull*/ XPathException exception) throws XPathException { errorCount++; if (firstError == null) { firstError = exception; } ((QueryModule) env).reportStaticError(exception); throw exception; }
/** * Parse the "declare revalidation" declaration. * Syntax: not allowed unless XQuery update is in use * * @throws XPathException if the syntax is incorrect, or is not allowed in this XQuery processor */ protected void parseRevalidationDeclaration() throws XPathException { grumble("declare revalidation is allowed only in XQuery Update"); }
/** * Ask whether schema-awareness has been requested either by means of a call on * {@link #setSchemaAware} * * @return true if schema-awareness has been requested * @since 9.2 */ public boolean isSchemaAware() { return env.isSchemaAware(); }
/** * Protected constructor * * @param processor the Saxon processor * @param expression the XQuery expression */ protected XQueryEvaluator(Processor processor, XQueryExpression expression) { this.processor = processor; this.expression = expression; this.context = new DynamicQueryContext(expression.getConfiguration()); }
/** * Check that all the types used in the signature of an imported function * are available in the module of the caller of the function * @param fd the declaration of the imported function * @throws XPathException if an error is found */ public void checkImportedFunctionSignature(XQueryFunction fd) throws XPathException { checkImportedType(fd.getResultType(), fd); for (int a=0; a<fd.getNumberOfArguments(); a++) { SequenceType argType = fd.getArgumentTypes()[a]; checkImportedType(argType, fd); } }
private void parseDefaultCollation() throws XPathException { // <"default" "collation"> StringLiteral if (foundDefaultCollation) { grumble("default collation appears more than once", "XQST0038"); } foundDefaultCollation = true; nextToken(); expect(Token.STRING_LITERAL); String uri = uriLiteral(t.currentTokenValue); ((QueryModule) env).setDefaultCollationName(uri); nextToken(); }
private void parseDefaultCollation() throws XPathException { // <"default" "collation"> StringLiteral if (foundDefaultCollation) { grumble("default collation appears more than once", "XQST0038"); } foundDefaultCollation = true; nextToken(); expect(Token.STRING_LITERAL); String uri = URILiteral(t.currentTokenValue); ((QueryModule)env).setDefaultCollationName(uri); nextToken(); }