net.sf.saxon.dotnet

Class DotNetURIResolver

Implemented Interfaces:
RelativeURIResolver, URIResolver

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

Source
dereference(String uri)
Called by the processor when it encounters an xsl:include, xsl:import, or document() function.
XmlResolver
getXmlResolver()
String
makeAbsolute(String href, String base)
Create an absolute URI from a relative URI and a base URI.
Source
resolve(String href, String base)
Called by an XSLT processor when it encounters an xsl:include, xsl:import, or document() function.
void
setExpectedMediaType(String mediaType)
Specify the media type of the resource that is expected to be delivered.

Constructor Details

DotNetURIResolver

public DotNetURIResolver(XmlResolver resolver)

Method Details

dereference

public Source dereference(String uri)
            throws 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.

getXmlResolver

public XmlResolver getXmlResolver()

makeAbsolute

public String makeAbsolute(String href,
                           String base)
            throws 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.

resolve

public Source resolve(String href,
                      String base)
            throws TransformerException
Called by an XSLT processor when it encounters an xsl:include, xsl:import, or document() function.
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.

setExpectedMediaType

public void setExpectedMediaType(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