/** * Get the URI resolver. This gets the local URIResolver set in the XPathContext if there * is one; if not, it gets the URIResolver from the Controller (which itself defaults to the * one set in the Configuration). * * @return the user-supplied URI resolver if there is one, or null otherwise. * @since 9.6 */ public URIResolver getURIResolver() { return config.getURIResolver(); }
/** * Get the URI resolver. This gets the local URIResolver set in the XPathContext if there * is one; if not, it gets the URIResolver from the Controller (which itself defaults to the * one set in the Configuration). * * @return the user-supplied URI resolver if there is one, or null otherwise. * @since 9.6 */ public URIResolver getURIResolver() { return config.getURIResolver(); }
/** * Get the object that is used by default during the transformation * to resolve URIs used in document(), xsl:import, or xsl:include. * * @return The URIResolver that was set with setURIResolver. */ public URIResolver getURIResolver() { return config.getURIResolver(); }
/** * Get the object that is used by default during the transformation * to resolve URIs used in document(), xsl:import, or xsl:include. * * @return The URIResolver that was set with setURIResolver. */ public URIResolver getURIResolver() { return config.getURIResolver(); }
protected IdentityTransformer(Configuration config) { this.configuration = config; this.uriResolver = config.getURIResolver(); }
protected IdentityTransformer(Configuration config) { this.configuration = config; this.uriResolver = config.getURIResolver(); }
/** * Get the object that is used by default during the transformation * to resolve URIs used in document(), xsl:import, or xsl:include. * * @return The URIResolver that was set with setURIResolver. */ public URIResolver getURIResolver() { return getConfiguration().getURIResolver(); }
/** * Get the object that is used by default during the transformation * to resolve URIs used in document(), xsl:import, or xsl:include. * * @return The URIResolver that was set with setURIResolver. */ public URIResolver getURIResolver() { return getConfiguration().getURIResolver(); }
/** * <p>Reset this <code>Transformer</code> to its original configuration.</p> * <p><code>Transformer</code> is reset to the same state as when it was created with * {@link javax.xml.transform.TransformerFactory#newTransformer()}, * {@link javax.xml.transform.TransformerFactory#newTransformer(javax.xml.transform.Source source)} or * {@link javax.xml.transform.Templates#newTransformer()}. * <code>reset()</code> is designed to allow the reuse of existing <code>Transformer</code>s * thus saving resources associated with the creation of new <code>Transformer</code>s.</p> * <p>The reset <code>Transformer</code> is not guaranteed to have the same {@link javax.xml.transform.URIResolver} * or {@link javax.xml.transform.ErrorListener} <code>Object</code>s, e.g. {@link Object#equals(Object obj)}. * It is guaranteed to have a functionally equal <code>URIResolver</code> * and <code>ErrorListener</code>.</p> * * @throws UnsupportedOperationException When implementation does not * override this method. * @since 1.5 */ @Override public void reset() { localOutputProperties = null; uriResolver = getConfiguration().getURIResolver(); errorListener = null; }
protected Source processSourceFile(String sourceFileName, boolean useURLs) throws TransformerException { Source sourceInput; if (useURLs || CommandLineOptions.isImplicitURI(sourceFileName)) { sourceInput = config.getURIResolver().resolve(sourceFileName, null); if (sourceInput == null) { sourceInput = config.getSystemURIResolver().resolve(sourceFileName, null); } } else if (sourceFileName.equals("-")) { // take input from stdin sourceInput = new StreamSource(System.in); } else { File sourceFile = new File(sourceFileName); if (!sourceFile.exists()) { quit("Source file " + sourceFile + " does not exist", 2); } if (Version.platform.isJava()) { InputSource eis = new InputSource(sourceFile.toURI().toString()); sourceInput = new SAXSource(eis); } else { sourceInput = new StreamSource(sourceFile.toURI().toString()); } } return sourceInput; }
/** * Create the dynamic context for a query * @param config the Saxon configuration */ public DynamicQueryContext(Configuration config) { this.config = config; uriResolver = config.getURIResolver(); errorListener = config.getErrorListener(); traceListener = config.getTraceListener(); if (errorListener instanceof StandardErrorListener) { errorListener = ((StandardErrorListener)errorListener).makeAnother(Configuration.XQUERY); ((StandardErrorListener)errorListener).setRecoveryPolicy(Configuration.DO_NOT_RECOVER); } }
/** * Create the dynamic context for a query * * @param config the Saxon configuration * @since 8.4. */ public DynamicQueryContext(/*@NotNull*/ Configuration config) { this.config = config; uriResolver = config.getURIResolver(); errorListener = config.getErrorListener(); if (errorListener instanceof StandardErrorListener) { errorListener = ((StandardErrorListener) errorListener).makeAnother(Configuration.XQUERY); ((StandardErrorListener) errorListener).setRecoveryPolicy(Configuration.DO_NOT_RECOVER); } traceFunctionDestination = config.getLogger(); }
/** * Create the dynamic context for a query * * @param config the Saxon configuration * @since 8.4. */ public DynamicQueryContext(/*@NotNull*/ Configuration config) { this.config = config; uriResolver = config.getURIResolver(); errorListener = config.getErrorListener(); if (errorListener instanceof StandardErrorListener) { errorListener = ((StandardErrorListener) errorListener).makeAnother(Configuration.XQUERY); ((StandardErrorListener) errorListener).setRecoveryPolicy(Configuration.DO_NOT_RECOVER); } traceFunctionDestination = config.getLogger(); }
/** * Create the dynamic context for a query * @param config the Saxon configuration * @since 8.4. */ public DynamicQueryContext(Configuration config) { this.config = config; uriResolver = config.getURIResolver(); errorListener = config.getErrorListener(); try { traceListener = config.makeTraceListener(); } catch (XPathException err) { throw new IllegalStateException(err.getMessage()); } if (errorListener instanceof StandardErrorListener) { errorListener = ((StandardErrorListener)errorListener).makeAnother(Configuration.XQUERY); ((StandardErrorListener)errorListener).setRecoveryPolicy(Configuration.DO_NOT_RECOVER); } }
/** * Make a PipelineConfiguration from the properties of this Configuration * * @return a new PipelineConfiguration * @since 8.4 */ public PipelineConfiguration makePipelineConfiguration() { PipelineConfiguration pipe = new PipelineConfiguration(this); pipe.setURIResolver(getURIResolver()); pipe.setParseOptions(new ParseOptions(defaultParseOptions)); pipe.setErrorListener(getErrorListener()); return pipe; }
/** * Make a PipelineConfiguration from the properties of this Configuration * * @return a new PipelineConfiguration * @since 8.4 */ public PipelineConfiguration makePipelineConfiguration() { PipelineConfiguration pipe = new PipelineConfiguration(this); pipe.setURIResolver(getURIResolver()); pipe.setParseOptions(new ParseOptions(defaultParseOptions)); pipe.setErrorListener(getErrorListener()); return pipe; }
/** * Protected constructor * @param processor the Saxon processor */ protected XsltCompiler(Processor processor) { this.processor = processor; this.config = processor.getUnderlyingConfiguration(); compilerInfo = new CompilerInfo(); compilerInfo.setURIResolver(config.getURIResolver()); compilerInfo.setErrorListener(config.getErrorListener()); compilerInfo.setCompileWithTracing(config.isCompileWithTracing()); }
public Iterator<XmlResource> getResources(XPathContext context) throws XPathException { List<XmlResource> resources = new ArrayList<XmlResource>(); SequenceIterator<?> iter = collectionURIResolver.resolve(collectionURI, "", context); Configuration config = context.getConfiguration(); URIResolver uriResolver = config.getURIResolver(); ParseOptions options = new ParseOptions(config.getParseOptions()); options.setSpaceStrippingRule(whitespaceRules); iter.forEachOrFail(item -> { if (item instanceof AnyURIValue) { Source source; try { source = uriResolver.resolve(item.getStringValue(), ""); } catch (TransformerException e) { throw XPathException.makeXPathException(e); } TreeInfo treeInfo = config.buildDocumentTree(source, options); resources.add(new XmlResource(treeInfo.getRootNode())); } else if (item instanceof NodeInfo) { resources.add(new XmlResource((NodeInfo) item)); } else { throw new XPathException("Result of CollectionURIResolver must consist of xs:anyURI values and/or nodes"); } }); return resources.iterator(); }
/** * Make a PipelineConfiguration from the properties of this Configuration * @return a new PipelineConfiguration * @since 8.4 */ public PipelineConfiguration makePipelineConfiguration() { PipelineConfiguration pipe = new PipelineConfiguration(); pipe.setConfiguration(this); pipe.setErrorListener(getErrorListener()); pipe.setURIResolver(getURIResolver()); pipe.setSchemaURIResolver(getSchemaURIResolver()); pipe.setHostLanguage(getHostLanguage()); pipe.setExpandAttributeDefaults(isExpandAttributeDefaults()); return pipe; }
/** * Make a PipelineConfiguration from the properties of this Configuration * * @return a new PipelineConfiguration * @since 8.4 */ public PipelineConfiguration makePipelineConfiguration() { PipelineConfiguration pipe = new PipelineConfiguration(); pipe.setConfiguration(this); pipe.setErrorListener(getErrorListener()); pipe.setURIResolver(getURIResolver()); pipe.setSchemaURIResolver(getSchemaURIResolver()); pipe.setHostLanguage(getHostLanguage()); pipe.setExpandAttributeDefaults(isExpandAttributeDefaults()); pipe.setUseXsiSchemaLocation(useXsiSchemaLocation); return pipe; }