net.sf.saxon.dotnet
Class DotNetURIResolver

java.lang.Object
  extended by net.sf.saxon.dotnet.DotNetURIResolver
All Implemented Interfaces:
javax.xml.transform.URIResolver, RelativeURIResolver

public class DotNetURIResolver
extends java.lang.Object
implements RelativeURIResolver

This class implements the JAXP URIResolver as a wrapper around a .NET XmlResolver.


Constructor Summary
DotNetURIResolver(XmlResolver resolver)
           
 
Method Summary
 javax.xml.transform.Source dereference(java.lang.String uri)
          Called by the processor when it encounters an xsl:include, xsl:import, or document() function.
 XmlResolver getXmlResolver()
           
 java.lang.String makeAbsolute(java.lang.String href, java.lang.String base)
          Create an absolute URI from a relative URI and a base URI.
 javax.xml.transform.Source resolve(java.lang.String href, java.lang.String base)
          Called by an XSLT processor when it encounters an xsl:include, xsl:import, or document() function.
 void setExpectedMediaType(java.lang.String mediaType)
          Specify the media type of the resource that is expected to be delivered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DotNetURIResolver

public DotNetURIResolver(XmlResolver resolver)
Method Detail

getXmlResolver

public XmlResolver getXmlResolver()

setExpectedMediaType

public void setExpectedMediaType(java.lang.String mediaType)
Specify the media type of the resource that is expected to be delivered. This information is supplied by the processor primarily to indicate whether the URIResolver is allowed to return an XML tree already parsed. If the value is "text/plain" then the Source returned by the resolve() method should be a StreamSource.

Specified by:
setExpectedMediaType in interface RelativeURIResolver
Parameters:
mediaType - the expected media type

makeAbsolute

public java.lang.String makeAbsolute(java.lang.String href,
                                     java.lang.String base)
                              throws javax.xml.transform.TransformerException
Create an absolute URI from a relative URI and a base URI. This method performs the process which is correctly called "URI resolution": this is purely a syntactic operation on the URI strings, and does not retrieve any resources.

Specified by:
makeAbsolute in interface RelativeURIResolver
Parameters:
href - A relative or absolute URI, to be resolved against the specified base URI
base - The base URI against which the first argument will be made absolute if the absolute URI is required.
Returns:
A string containing the absolute URI that results from URI resolution. If the resource needs to be fetched, this absolute URI will be supplied as the href parameter in a subsequent call to the resolve method.
Throws:
javax.xml.transform.TransformerException

resolve

public javax.xml.transform.Source resolve(java.lang.String href,
                                          java.lang.String base)
                                   throws javax.xml.transform.TransformerException
Called by an XSLT processor when it encounters an xsl:include, xsl:import, or document() function.

Specified by:
resolve in interface javax.xml.transform.URIResolver
Specified by:
resolve in interface RelativeURIResolver
Parameters:
href - An href attribute, holding a relative or absolute URI.
base - The base URI, ignored if href is absolute.
Returns:
A Source object, or null if the href cannot be resolved, and the processor should try to resolve the URI itself.
Throws:
javax.xml.transform.TransformerException - if an error occurs when trying to resolve the URI.

dereference

public javax.xml.transform.Source dereference(java.lang.String uri)
                                       throws javax.xml.transform.TransformerException
Called by the processor when it encounters an xsl:include, xsl:import, or document() function.

Specified by:
dereference in interface RelativeURIResolver
Parameters:
uri - The absolute URI to be dereferenced
Returns:
A Source object, or null if the href cannot be dereferenced, and the processor should try to resolve the URI itself.
Throws:
javax.xml.transform.TransformerException - if an error occurs when trying to dereference the URI.