| java.lang.Object org.apache.xerces.util.XMLCatalogResolver
XMLCatalogResolver | public class XMLCatalogResolver implements XMLEntityResolver,EntityResolver2,LSResourceResolver(Code) | | The catalog resolver handles the resolution of external
identifiers and URI references through XML catalogs. This
component supports XML catalogs defined by the
OASIS XML Catalogs Specification. It encapsulates the
XML Commons resolver.
An instance of this class may be registered on the parser
as a SAX entity resolver, as a DOM LSResourceResolver or
as an XNI entity resolver by setting the property
(http://apache.org/xml/properties/internal/entity-resolver).
It is intended that this class may be used standalone to perform
catalog resolution outside of a parsing context. It may be shared
between several parsers and the application.
author: Michael Glavassevich, IBM version: $Id: XMLCatalogResolver.java 570138 2007-08-27 14:21:51Z mrglavas $ |
Method Summary | |
final public synchronized void | clear() | final public synchronized String[] | getCatalogList() | public InputSource | getExternalSubset(String name, String baseURI) Locates an external subset for documents which do not explicitly
provide one. | final public boolean | getPreferPublic() Returns the preference for whether system or public
matches are preferred. | final public boolean | getUseLiteralSystemId() Returns the preference for whether the literal system
identifier should be used when resolving system
identifiers when both it and the expanded system
identifier are available. | public InputSource | resolveEntity(String publicId, String systemId) Resolves an external entity. | public InputSource | resolveEntity(String name, String publicId, String baseURI, String systemId) Resolves an external entity. | public XMLInputSource | resolveEntity(XMLResourceIdentifier resourceIdentifier) Resolves an external entity. | public String | resolveIdentifier(XMLResourceIdentifier resourceIdentifier) Resolves an identifier using the catalog. | final public synchronized String | resolvePublic(String publicId, String systemId) Returns the URI mapping in the catalog for the given
external identifier or null if no mapping
exists. | public LSInput | resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) Resolves a resource using the catalog. | final public synchronized String | resolveSystem(String systemId) Returns the URI mapping in the catalog for the given
external identifier or null if no mapping
exists. | final public synchronized String | resolveURI(String uri) Returns the URI mapping in the catalog for the given URI
reference or null if no mapping exists. | final public synchronized void | setCatalogList(String[] catalogs) Sets the initial list of catalog entry files. | final public void | setPreferPublic(boolean preferPublic) Sets the preference for whether system or public
matches are preferred. | final public void | setUseLiteralSystemId(boolean useLiteralSystemId) Sets the preference for whether the literal system
identifier should be used when resolving system
identifiers when both it and the expanded system
identifier are available.
The literal system identifier is the URI as it was
provided before absolutization. |
XMLCatalogResolver | public XMLCatalogResolver()(Code) | | Constructs a catalog resolver with a default configuration.
|
XMLCatalogResolver | public XMLCatalogResolver(String[] catalogs)(Code) | | Constructs a catalog resolver with the given
list of entry files.
Parameters: catalogs - an ordered array list of absolute URIs |
XMLCatalogResolver | public XMLCatalogResolver(String[] catalogs, boolean preferPublic)(Code) | | Constructs a catalog resolver with the given
list of entry files and the preference for whether
system or public matches are preferred.
Parameters: catalogs - an ordered array list of absolute URIs Parameters: preferPublic - the prefer public setting |
clear | final public synchronized void clear()(Code) | | Forces the cache of catalog mappings to be cleared.
|
getCatalogList | final public synchronized String[] getCatalogList()(Code) | | Returns the initial list of catalog entry files.
the initial list of catalog entry files |
getExternalSubset | public InputSource getExternalSubset(String name, String baseURI) throws SAXException, IOException(Code) | | Locates an external subset for documents which do not explicitly
provide one. This method always returns null . It
should be overrided if other behaviour is required.
Parameters: name - the identifier of the document root element Parameters: baseURI - the document's base URI throws: SAXException - any SAX exception, possibly wrapping another exception throws: IOException - thrown if some i/o error occurs |
getPreferPublic | final public boolean getPreferPublic()(Code) | | Returns the preference for whether system or public
matches are preferred. This is used in the absence
of any occurrence of the prefer attribute
on the catalog entry of a catalog. If this
property has not yet been explicitly set its value is
true .
the prefer public setting |
getUseLiteralSystemId | final public boolean getUseLiteralSystemId()(Code) | | Returns the preference for whether the literal system
identifier should be used when resolving system
identifiers when both it and the expanded system
identifier are available. If this property has not yet
been explicitly set its value is true .
the preference for using literal system identifiersfor catalog resolution See Also: XMLCatalogResolver.setUseLiteralSystemId |
resolveEntity | public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException(Code) | | Resolves an external entity. If the entity cannot be
resolved, this method should return null . This
method returns an input source if an entry was found in the
catalog for the given external identifier. It should be
overridden if other behaviour is required.
Parameters: publicId - the public identifier, or null if none was supplied Parameters: systemId - the system identifier throws: SAXException - any SAX exception, possibly wrapping another exception throws: IOException - thrown if some i/o error occurs |
resolveEntity | public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException(Code) | | Resolves an external entity. If the entity cannot be
resolved, this method should return null . This
method returns an input source if an entry was found in the
catalog for the given external identifier. It should be
overridden if other behaviour is required.
Parameters: name - the identifier of the external entity Parameters: publicId - the public identifier, or null if none was supplied Parameters: baseURI - the URI with respect to which relative systemIDs are interpreted. Parameters: systemId - the system identifier throws: SAXException - any SAX exception, possibly wrapping another exception throws: IOException - thrown if some i/o error occurs |
resolveEntity | public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException(Code) | | Resolves an external entity. If the entity cannot be
resolved, this method should return null . This
method only calls resolveIdentifier and returns
an input source if an entry was found in the catalog. It
should be overridden if other behaviour is required.
Parameters: resourceIdentifier - location of the XML resource to resolve throws: XNIException - thrown on general error throws: IOException - thrown if some i/o error occurs |
resolveIdentifier | public String resolveIdentifier(XMLResourceIdentifier resourceIdentifier) throws IOException, XNIException(Code) | | Resolves an identifier using the catalog. This method interprets that
the namespace of the identifier corresponds to uri entries in the catalog.
Where both a namespace and an external identifier exist, the namespace
takes precedence.
Parameters: resourceIdentifier - the identifier to resolve throws: XNIException - thrown on general error throws: IOException - thrown if some i/o error occurs |
resolvePublic | final public synchronized String resolvePublic(String publicId, String systemId) throws IOException(Code) | | Returns the URI mapping in the catalog for the given
external identifier or null if no mapping
exists. Public identifiers are normalized before
comparison.
Parameters: publicId - the public identifier to locate in the catalog Parameters: systemId - the system identifier to locate in the catalog the mapped URI or null if no mappingwas found in the catalog throws: IOException - if an i/o error occurred while readingthe catalog |
resolveResource | public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI)(Code) | | Resolves a resource using the catalog. This method interprets that
the namespace URI corresponds to uri entries in the catalog.
Where both a namespace and an external identifier exist, the namespace
takes precedence.
Parameters: type - the type of the resource being resolved Parameters: namespaceURI - the namespace of the resource being resolved, or null if none was supplied Parameters: publicId - the public identifier of the resource being resolved,or null if none was supplied Parameters: systemId - the system identifier of the resource being resolved,or null if none was supplied Parameters: baseURI - the absolute base URI of the resource being parsed, or null if there is no base URI |
resolveSystem | final public synchronized String resolveSystem(String systemId) throws IOException(Code) | | Returns the URI mapping in the catalog for the given
external identifier or null if no mapping
exists. If the system identifier is an URN in the
publicid namespace it is converted into
a public identifier by URN "unwrapping" as specified
in the XML Catalogs specification.
Parameters: systemId - the system identifier to locate in the catalog the mapped URI or null if no mappingwas found in the catalog throws: IOException - if an i/o error occurred while readingthe catalog |
resolveURI | final public synchronized String resolveURI(String uri) throws IOException(Code) | | Returns the URI mapping in the catalog for the given URI
reference or null if no mapping exists.
URI comparison is case sensitive. If the URI reference
is an URN in the publicid namespace
it is converted into a public identifier by URN "unwrapping"
as specified in the XML Catalogs specification and then
resolution is performed following the semantics of
external identifier resolution.
Parameters: uri - the URI to locate in the catalog the mapped URI or null if no mappingwas found in the catalog throws: IOException - if an i/o error occurred while readingthe catalog |
setCatalogList | final public synchronized void setCatalogList(String[] catalogs)(Code) | | Sets the initial list of catalog entry files.
If there were any catalog mappings cached from
the previous list they will be replaced by catalog
mappings from the new list the next time the catalog
is queried.
Parameters: catalogs - an ordered array list of absolute URIs |
setPreferPublic | final public void setPreferPublic(boolean preferPublic)(Code) | | Sets the preference for whether system or public
matches are preferred. This is used in the absence
of any occurrence of the prefer attribute
on the catalog entry of a catalog.
Parameters: preferPublic - the prefer public setting |
setUseLiteralSystemId | final public void setUseLiteralSystemId(boolean useLiteralSystemId)(Code) | | Sets the preference for whether the literal system
identifier should be used when resolving system
identifiers when both it and the expanded system
identifier are available.
The literal system identifier is the URI as it was
provided before absolutization. It may be embedded within
an entity. It may be provided externally or it may be the
result of redirection. For example, redirection may
have come from the protocol level through HTTP or from
an application's entity resolver.
The expanded system identifier is an absolute URI
which is the result of resolving the literal system
identifier against a base URI.
Parameters: useLiteralSystemId - the preference for using literal system identifiers for catalog resolution |
|
|