net.sf.saxon
Class StandardURIResolver

java.lang.Object
  extended bynet.sf.saxon.StandardURIResolver
All Implemented Interfaces:
javax.xml.transform.URIResolver

public class StandardURIResolver
extends java.lang.Object
implements javax.xml.transform.URIResolver

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.


Constructor Summary
StandardURIResolver()
          Create a StandardURIResolver, with no reference to a TransformerFactory
StandardURIResolver(Configuration config)
          Create a StandardURIResolver, with a reference to a TransformerFactory
 
Method Summary
static java.net.URI makeAbsolute(java.lang.String relativeURI, java.lang.String base)
          Combine the relative URI and base URI
 javax.xml.transform.Source resolve(java.lang.String href, java.lang.String base)
          Resolve a URI
static java.lang.String tryToExpand(java.lang.String systemId)
          If a system ID can't be parsed as a URL, we'll try to expand it as a relative URI using the current directory as the base URI: MHK addition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardURIResolver

public StandardURIResolver()
Create a StandardURIResolver, with no reference to a TransformerFactory


StandardURIResolver

public StandardURIResolver(Configuration config)
Create a StandardURIResolver, with a reference to a TransformerFactory

Parameters:
config - The Configuration object. This is used to get a SAX Parser for a source XML document
Method Detail

resolve

public javax.xml.transform.Source resolve(java.lang.String href,
                                          java.lang.String base)
                                   throws XPathException
Resolve a URI

Specified by:
resolve in interface javax.xml.transform.URIResolver
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
Throws:
XPathException

makeAbsolute

public static java.net.URI makeAbsolute(java.lang.String relativeURI,
                                        java.lang.String base)
                                 throws DynamicError,
                                        java.net.URISyntaxException
Combine the relative URI and base URI

Throws:
DynamicError
java.net.URISyntaxException

tryToExpand

public static java.lang.String tryToExpand(java.lang.String systemId)
If a system ID can't be parsed as a URL, we'll try to expand it as a relative URI using the current directory as the base URI: MHK addition.