public class StandardURIResolver extends java.lang.Object implements NonDelegatingURIResolver
Source.
It is used to get stylesheet modules referenced by xsl:import and xsl:include,
and source documents referenced by the document() function. The standard version
handles anything that the java URL class will handle, plus the classpath
URI scheme defined in the Spring framework, and the data URI scheme defined in
RFC 2397.
You can write a subclass to handle other kinds of URI, for example references to data in a database, or to handle standard URIs in non-standard ways, for example by supplying authentication credentials.
| Constructor and Description |
|---|
StandardURIResolver()
Create a StandardURIResolver, with no reference to a Configuration.
|
StandardURIResolver(Configuration config)
Create a StandardURIResolver, with a reference to a Configuration
|
| Modifier and Type | Method and Description |
|---|---|
java.util.function.Predicate<java.net.URI> |
getAllowedUriTest()
Set a Predicate that is applied to a URI to determine whether the resolver should accept it.
|
Configuration |
getConfiguration()
Get the configuration if available
|
protected Platform |
getPlatform()
Get the relevant platform
|
protected javax.xml.transform.Source |
getPTreeSource(java.lang.String href,
java.lang.String base)
Handle a PTree source file (Saxon-EE only)
|
boolean |
queryParametersAreRecognized()
Determine whether query parameters (such as validation=strict) are to be recognized
|
javax.xml.transform.Source |
resolve(java.lang.String href,
java.lang.String base)
Resolve a URI
|
void |
setAllowedUriTest(java.util.function.Predicate<java.net.URI> test)
Set a Predicate that is applied to a URI to determine whether the resolver should accept it.
|
void |
setConfiguration(Configuration config)
Set the configuration
|
void |
setRecognizeQueryParameters(boolean recognize)
Indicate that query parameters (such as validation=strict) are to be recognized
|
protected void |
setSAXInputSource(javax.xml.transform.sax.SAXSource source,
java.lang.String uriString)
Set the InputSource part of the returned SAXSource.
|
public StandardURIResolver()
setConfiguration()public StandardURIResolver(Configuration config)
config - The Configuration object. May be null.
This is used (if available) to get a reusable SAX Parser for a source XML documentpublic void setRecognizeQueryParameters(boolean recognize)
recognize - Set to true if query parameters in the URI are to be recognized and acted upon.
The default (for compatibility and interoperability reasons) is false.public boolean queryParametersAreRecognized()
public void setAllowedUriTest(java.util.function.Predicate<java.net.URI> test)
It is possible to set the default predicate by means of the configuration property
Feature.ALLOWED_PROTOCOLS.
test - the predicate to be applied to the absolute URI.public java.util.function.Predicate<java.net.URI> getAllowedUriTest()
The default predicate can be set by means of the configuration property
Feature.ALLOWED_PROTOCOLS.
protected Platform getPlatform()
public void setConfiguration(Configuration config)
config - the configurationpublic Configuration getConfiguration()
public javax.xml.transform.Source resolve(java.lang.String href,
java.lang.String base)
throws XPathException
resolve in interface javax.xml.transform.URIResolverhref - The relative or absolute URI. May be an empty string. May contain
a fragment identifier starting with "#", which must be the value of an ID attribute
in the referenced XML document.base - The base URI that should be used. May be null if uri is absolute.XPathExceptionprotected javax.xml.transform.Source getPTreeSource(java.lang.String href,
java.lang.String base)
throws XPathException
href - the relative URIbase - the base URIXPathExceptionprotected void setSAXInputSource(javax.xml.transform.sax.SAXSource source,
java.lang.String uriString)
source - the SAXSource being initializeduriString - the absolute (resolved) URI to be usedCopyright (c) 2004-2021 Saxonica Limited. All rights reserved.