Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.saxon
Interface RelativeURIResolver

All Superinterfaces:
  javax.xml.transform.URIResolver

public interface RelativeURIResolver
extends javax.xml.transform.URIResolver

The standard JAXP URIResolver is given a relative URI and a base URI and returns the resource identified by this combination. However, to support a stable implementation of the doc() function, Saxon needs to know what the absolute URI is before the resource is fetched, so it can determine whether a document with that absolute URI actually exists.

This extended interface defines a URIResolver that separates the two functions of resolving a relative URI against a base URI, and fetching a resource with that absolute URI. If the URI resolver supplied to Saxon implements this interface, the absolute URI associated with a loaded document will be the URI returned by this resolver.

The particular motivation for providing this interface is to allow a URIResolver to wrap a .NET XmlResolver, which has additional capability not present in the JAXP interface.

Method Summary
`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 the 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.

Method Detail

### resolve

    public javax.xml.transform.Source resolve(java.lang.String href,
                                              java.lang.String base)
                                       throws javax.xml.transform.TransformerException

  Called by the processor when it encounters an xsl:include, xsl:import, or document() function. Despite the name, the main purpose of this method is to dereference the URI, not merely to resolve it.

  Specified by:
    `resolve` in interface `javax.xml.transform.URIResolver`
  Parameters:
    `href` - An href attribute, which may be relative or absolute.
    `base` - The base URI against which the first argument will be made absolute if the absolute URI is required.
  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.

### 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.

  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`

### 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.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD