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.
| Modifier and Type | Field and Description |
|---|---|
| private Catalog | fCatalog
Internal catalog structure. |
| private boolean | fCatalogsChanged
Indicates whether the list of catalogs has changed since it was processed. |
| private String[] | fCatalogsList
An array of catalog URIs. |
| private boolean | fPreferPublic
Application specified prefer public setting. |
| private CatalogManager | fResolverCatalogManager
Internal catalog manager for Apache catalogs. |
| private boolean | fUseLiteralSystemId
Indicates whether the application desires that the parser or some other component performing catalog resolution should use the literal system identifier instead of the expanded system identifier. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | XMLCatalogResolver(String[]
an ordered array list of absolute URIs catalogs)Constructs a catalog resolver with the given list of entry files. |
| public | XMLCatalogResolver(String[]
an ordered array list of absolute URIs catalogs, boolean the prefer public setting preferPublic)Constructs a catalog resolver with the given list of entry files and the preference for whether system or public matches are preferred. |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public final synchronized void | |
| public final synchronized String[] | Returns: the initial list of catalog entry filesReturns the initial list of catalog entry files. |
| public InputSource | getExternalSubset(String
the identifier of the document root element name, String the document's base URI baseURI)Implements org. Locates an external subset for documents which do not explicitly provide one. |
| public final boolean | Returns: the prefer public settingReturns the preference for whether system or public matches are preferred. |
| public final boolean | Returns: the preference for using literal system identifiers for catalog resolutionReturns 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. |
| private void | |
| private void | |
| public InputSource | resolveEntity(String
the public identifier, or publicId, String null if none was suppliedthe system identifier systemId)Implements org. Resolves an external entity. |
| public InputSource | resolveEntity(String
the identifier of the external entity name, String the public identifier, or publicId, String null if none was suppliedthe URI with respect to which relative systemIDs are interpreted. baseURI, String the system identifier systemId)Implements org. Resolves an external entity. |
| public XMLInputSource | resolveEntity(XMLResourceIdentifier
location of the XML resource to resolve resourceIdentifier)Implements org. Resolves an external entity. |
| public String | resolveIdentifier(XMLResourceIdentifier
the identifier to resolve resourceIdentifier)Resolves an identifier using the catalog. |
| public final synchronized String | Returns: the mapped URI ornull if no mapping
was found in the catalogthe public identifier to locate in the catalog publicId, String the system identifier to locate in the catalog systemId)Returns the URI mapping in the catalog for the given
external identifier or |
| public LSInput | resolveResource(String
the type of the resource being resolved type, String the namespace of the resource being resolved,
or namespaceURI, String null if none was suppliedthe public identifier of the resource being resolved,
or publicId, String null if none was suppliedthe system identifier of the resource being resolved,
or systemId, String null if none was suppliedthe absolute base URI of the resource being parsed,
or baseURI)null if there is no base URIImplements org. Resolves a resource using the catalog. |
| public final synchronized String | Returns: the mapped URI ornull if no mapping
was found in the catalogthe system identifier to locate in the catalog systemId)Returns the URI mapping in the catalog for the given
external identifier or |
| public final synchronized String | Returns: the mapped URI ornull if no mapping
was found in the catalogthe URI to locate in the catalog uri)Returns the URI mapping in the catalog for the given URI
reference or |
| public final synchronized void | setCatalogList(String[]
an ordered array list of absolute URIs catalogs)Sets the initial list of catalog entry files. |
| public final void | setPreferPublic(boolean
the prefer public setting preferPublic)Sets the preference for whether system or public matches are preferred. |
| public final void | setUseLiteralSystemId(boolean
the preference for using
literal system identifiers for catalog resolution 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. |
| fCatalog | back to summary |
|---|---|
| private Catalog fCatalog Internal catalog structure. | |
| fCatalogsChanged | back to summary |
|---|---|
| private boolean fCatalogsChanged Indicates whether the list of catalogs has changed since it was processed. | |
| fCatalogsList | back to summary |
|---|---|
| private String[] fCatalogsList An array of catalog URIs. | |
| fPreferPublic | back to summary |
|---|---|
| private boolean fPreferPublic Application specified prefer public setting. | |
| fResolverCatalogManager | back to summary |
|---|---|
| private CatalogManager fResolverCatalogManager Internal catalog manager for Apache catalogs. | |
| fUseLiteralSystemId | back to summary |
|---|---|
| private boolean fUseLiteralSystemId Indicates whether the application desires that the parser or some other component performing catalog resolution should use the literal system identifier instead of the expanded system identifier. | |
| XMLCatalogResolver | back to summary |
|---|---|
| public XMLCatalogResolver() Constructs a catalog resolver with a default configuration. | |
| XMLCatalogResolver | back to summary |
|---|---|
| public XMLCatalogResolver(String[] catalogs) Constructs a catalog resolver with the given list of entry files.
| |
| XMLCatalogResolver | back to summary |
|---|---|
| public XMLCatalogResolver(String[] catalogs, boolean preferPublic) Constructs a catalog resolver with the given list of entry files and the preference for whether system or public matches are preferred.
| |
| attachReaderToCatalog | back to summary |
|---|---|
| private void attachReaderToCatalog(Catalog catalog) Attaches the reader to the catalog. | |
| clear | back to summary |
|---|---|
| public final synchronized void clear() Forces the cache of catalog mappings to be cleared. | |
| getCatalogList | back to summary |
|---|---|
| public final synchronized String[] getCatalogList() Returns the initial list of catalog entry files.
| |
| getExternalSubset | back to summary |
|---|---|
| public InputSource getExternalSubset(String name, String baseURI) throws SAXException, IOException Implements org. Locates an external subset for documents which do not explicitly
provide one. This method always returns
| |
| getPreferPublic | back to summary |
|---|---|
| public final boolean getPreferPublic() Returns the preference for whether system or public
matches are preferred. This is used in the absence
of any occurrence of the
| |
| getUseLiteralSystemId | back to summary |
|---|---|
| public final 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. If this property has not yet
been explicitly set its value is
| |
| init | back to summary |
|---|---|
| private void init(String[] catalogs, boolean preferPublic) Initialization. Create a CatalogManager and set all the properties upfront. This prevents JVM wide system properties or a property file somewhere in the environment from affecting the behaviour of this catalog resolver. | |
| parseCatalogs | back to summary |
|---|---|
| private void parseCatalogs() throws IOException Instruct the | |
| resolveEntity | back to summary |
|---|---|
| public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException Implements org. Resolves an external entity. If the entity cannot be
resolved, this method should return
| |
| resolveEntity | back to summary |
|---|---|
| public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException Implements org. Resolves an external entity. If the entity cannot be
resolved, this method should return
| |
| resolveEntity | back to summary |
|---|---|
| public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException Implements org. Resolves an external entity. If the entity cannot be
resolved, this method should return
| |
| resolveIdentifier | back to summary |
|---|---|
| public String resolveIdentifier(XMLResourceIdentifier resourceIdentifier) throws IOException, XNIException 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.
| |
| resolvePublic | back to summary |
|---|---|
| public final synchronized String resolvePublic(String publicId, String systemId) throws IOException Returns the URI mapping in the catalog for the given
external identifier or
| |
| resolveResource | back to summary |
|---|---|
| public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) Implements org. 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.
| |
| resolveSystem | back to summary |
|---|---|
| public final synchronized String resolveSystem(String systemId) throws IOException Returns the URI mapping in the catalog for the given
external identifier or
| |
| resolveURI | back to summary |
|---|---|
| public final synchronized String resolveURI(String uri) throws IOException Returns the URI mapping in the catalog for the given URI
reference or
| |
| setCatalogList | back to summary |
|---|---|
| public final synchronized void setCatalogList(String[] catalogs) 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.
| |
| setPreferPublic | back to summary |
|---|---|
| public final void setPreferPublic(boolean preferPublic) Sets the preference for whether system or public
matches are preferred. This is used in the absence
of any occurrence of the
| |
| setUseLiteralSystemId | back to summary |
|---|---|
| public final 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. 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.
| |