com.icl.saxon
Class StandardURIResolver

java.lang.Object
  |
  +--com.icl.saxon.StandardURIResolver
All Implemented Interfaces:
URIResolver

public class StandardURIResolver
extends java.lang.Object
implements 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()
           
 
Method Summary
 org.w3c.dom.Node getDOMNode()
          This will be called by the processor when it encounters an xsl:include, xsl:import, or document() function, if it needs a DOM tree.
 org.xml.sax.InputSource getInputSource()
          Return an InputSource corresponding to the URL
 java.lang.String getURI()
          Get the absolute URI
 org.xml.sax.XMLReader getXMLReader()
          Return a SAX2 Parser to be used with this InputSource.
 void setParserClass(java.lang.String name)
          Set the name of the class to be used for parsing
 void setURI(java.lang.String baseURI, java.lang.String uri)
          Set a relative URI, given a base URI to resolve it
protected static java.net.URL toURL(java.lang.String systemID)
          Parse an absolute URI
protected static java.net.URL toURL(java.net.URL baseURL, java.lang.String systemID)
          Parse a relative URI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardURIResolver

public StandardURIResolver()
Method Detail

setParserClass

public void setParserClass(java.lang.String name)
Set the name of the class to be used for parsing

setURI

public void setURI(java.lang.String baseURI,
                   java.lang.String uri)
            throws TransformException
Set a relative URI, given a base URI to resolve it
Specified by:
setURI in interface URIResolver
Parameters:
baseURI - The base URI that should be used. May be null if uri is absolute.

getURI

public java.lang.String getURI()
Get the absolute URI
Specified by:
getURI in interface URIResolver

getDOMNode

public org.w3c.dom.Node getDOMNode()
This will be called by the processor when it encounters an xsl:include, xsl:import, or document() function, if it needs a DOM tree. This method is never called by Saxon.
Specified by:
getDOMNode in interface URIResolver
Parameters:
base - The base URI that should be used.
uri - Value from an xsl:import or xsl:include's href attribute, or a URI specified in the document() function.

getInputSource

public org.xml.sax.InputSource getInputSource()
Return an InputSource corresponding to the URL
Specified by:
getInputSource in interface URIResolver

getXMLReader

public org.xml.sax.XMLReader getXMLReader()
                                   throws TransformException
Return a SAX2 Parser to be used with this InputSource.
Specified by:
getXMLReader in interface URIResolver
Returns:
an instance of the class supplied to setParserClass(), if called

toURL

protected static java.net.URL toURL(java.lang.String systemID)
                             throws TransformException
Parse an absolute URI

toURL

protected static java.net.URL toURL(java.net.URL baseURL,
                                    java.lang.String systemID)
                             throws TransformException
Parse a relative URI