org.inria.ns.reflex.xml
Class URIReferenceResolver

java.lang.Object
  extended by org.inria.ns.reflex.xml.ExternalIdentifierResolver
      extended by org.inria.ns.reflex.xml.URIReferenceResolver
All Implemented Interfaces:
URIResolver, Preferable, EntityResolver

public class URIReferenceResolver
extends ExternalIdentifierResolver
implements URIResolver

Resolves URI references with a catalog.

Text inclusion

A special scheme is supported by this implementation in order to process text inclusion : the text scheme.

text:encoding:uri

If the encoding is missing, the default encoding is endorsed.

XSLT example : document( 'text:iso-8859-1:file:///path/to/file' ) will load the file as text, even if it contains XML tags.

Author:
Philippe Poulard
See Also:
GlobalCatalog

Constructor Summary
URIReferenceResolver(int preferred, GlobalCatalog globalCatalog, XMLError xmlErrorHandler, QName selector, XFile baseLocation)
          Creates a resolver for URI references.
 
Method Summary
 Source resolve(String href, String base)
          Resolve an URI reference from a base ; unless explicitely specified, the resolution will use some catalogs.
 
Methods inherited from class org.inria.ns.reflex.xml.ExternalIdentifierResolver
getBaseLocation, getPreferred, resolveEntity
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URIReferenceResolver

public URIReferenceResolver(int preferred,
                            GlobalCatalog globalCatalog,
                            XMLError xmlErrorHandler,
                            QName selector,
                            XFile baseLocation)
Creates a resolver for URI references.

Parameters:
preferred - The external identifier preference mode :
  • as-is (0),
  • system (1),
  • public (2),
  • (-1) means to not use a catalog.
globalCatalog - Used for catalog lookup. May be null if the preference mode is (-1).
xmlErrorHandler - Used to report a warning if a catalog is not in the format expected. May be null if the preference mode is (-1), or if no warning wants to be reported.
selector - The selector used to distinguish several catalog entries with the same entry. May be null.
baseLocation - The base location that allow to resolve relative paths.
Method Detail

resolve

public Source resolve(String href,
                      String base)
               throws TransformerException
Resolve an URI reference from a base ; unless explicitely specified, the resolution will use some catalogs.

Specified by:
resolve in interface URIResolver
Parameters:
href - The URI reference to resolve.
base - The base URI, if the URI reference is relative.
Returns:
An XML source.
Throws:
TransformerException
See Also:
URIResolver.resolve(java.lang.String, java.lang.String)