org.inria.ns.reflex.xml
Class ExternalIdentifierResolver

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

public class ExternalIdentifierResolver
extends Object
implements EntityResolver, Preferable

A universal EntityResolver that deals with catalogs, on behalf of a tool that may express its preference regarding external identifiers. Usually used by XML parsers.

Author:
Philippe Poulard
See Also:
ParseAction, org.inria.ns.reflex.processor.catalog

Constructor Summary
ExternalIdentifierResolver(int preferred, GlobalCatalog globalCatalog, ErrorHandler errorHandler, XFile baseLocation)
          Creates a resolver for external identifiers.
 
Method Summary
 XFile getBaseLocation()
          Return the base location used to resolve relative paths.
 int getPreferred()
          Return the preferred mode.
 InputSource resolveEntity(String publicId, String systemId)
          Resolve an external identifier.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExternalIdentifierResolver

public ExternalIdentifierResolver(int preferred,
                                  GlobalCatalog globalCatalog,
                                  ErrorHandler errorHandler,
                                  XFile baseLocation)
Creates a resolver for external identifiers.

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).
errorHandler - 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.
baseLocation - The base location that allow to resolve relative paths.
Method Detail

resolveEntity

public InputSource resolveEntity(String publicId,
                                 String systemId)
                          throws SAXException,
                                 IOException
Resolve an external identifier.

Specified by:
resolveEntity in interface EntityResolver
Parameters:
publicId - The public ID, that may be null if the system ID is not-null.
systemId - The system ID, that may be null. if the public ID is not-null.
Returns:
The resolved input source.
Throws:
SAXException
IOException
See Also:
EntityResolver.resolveEntity(java.lang.String, java.lang.String)

getPreferred

public int getPreferred()
Return the preferred mode.

Specified by:
getPreferred in interface Preferable
Returns:
The preferred mode.
See Also:
Preferable.getPreferred()

getBaseLocation

public XFile getBaseLocation()
Return the base location used to resolve relative paths.

Returns:
The base location of this resolver.