net.sf.saxon

Class StandardURIResolver

Implemented Interfaces:
NonDelegatingURIResolver, Serializable, URIResolver
Known Direct Subclasses:
XomUriResolver

public class StandardURIResolver
extends java.lang.Object
implements NonDelegatingURIResolver, Serializable

This class provides the service of converting a URI into an InputSource. 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. You can write a subclass to handle other kinds of URI, e.g. references to things in a database.
Author:
Michael H. Kay

Field Summary

protected boolean
recognizeQueryParameters

Constructor Summary

StandardURIResolver()
Deprecated. since 8.7
StandardURIResolver(Configuration config)
Create a StandardURIResolver, with a reference to a Configuration

Method Summary

Configuration
getConfiguration()
Get the configuration if available
protected Source
getPTreeSource(String href, String base)
Handle a PTree source file (Saxon-SA only)
protected Platform
getPlatform()
Get the relevant platform
boolean
queryParametersAreRecognized()
Determine whether query parameters (such as validation=strict) are to be recognized
Source
resolve(String href, String base)
Resolve a URI
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(SAXSource source, String uriString)
Set the InputSource part of the returned SAXSource.

Field Details

recognizeQueryParameters

protected boolean recognizeQueryParameters

Constructor Details

StandardURIResolver

public StandardURIResolver()

Deprecated. since 8.7

Create a StandardURIResolver, with no reference to a Configuration. This constructor is not used internally by Saxon, but it may be used by user-written application code. It is deprecated because the StandardURIResolver works best when the Configuration is known.

StandardURIResolver

public StandardURIResolver(Configuration config)
Create a StandardURIResolver, with a reference to a Configuration
Parameters:
config - The Configuration object. This is used to get a SAX Parser for a source XML document

Method Details

getConfiguration

public Configuration getConfiguration()
Get the configuration if available
Returns:
the configuration

getPTreeSource

protected Source getPTreeSource(String href,
                                String base)
            throws XPathException
Handle a PTree source file (Saxon-SA only)
Parameters:
href - the relative URI
base - the base URI
Returns:
the new Source object

getPlatform

protected Platform getPlatform()
Get the relevant platform
Returns:
the platform

queryParametersAreRecognized

public boolean queryParametersAreRecognized()
Determine whether query parameters (such as validation=strict) are to be recognized
Returns:
true if query parameters are recognized and interpreted by Saxon.

resolve

public Source resolve(String href,
                      String base)
            throws XPathException
Resolve a URI
Parameters:
href - 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.
Returns:
a Source object representing an XML document

setConfiguration

public void setConfiguration(Configuration config)
Set the configuration
Parameters:
config - the configuration

setRecognizeQueryParameters

public void setRecognizeQueryParameters(boolean recognize)
Indicate that query parameters (such as validation=strict) are to be recognized
Parameters:
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.

setSAXInputSource

protected void setSAXInputSource(SAXSource source,
                                 String uriString)
Set the InputSource part of the returned SAXSource. This is done in a separate method to allow subclassing. The default implementation simply places the URI in the InputSource, allowing the XML parser to take responsibility for the dereferencing. A subclass may choose to dereference the URI at this point an place an InputStream in the SAXSource.
Parameters:
source - the SAXSource being initialized
uriString - the absolute (resolved) URI to be used