public class CatalogResolver extends Object implements EntityResolver
Modifier and Type | Class and Description |
---|---|
static class |
CatalogResolver.Catalog
Overrides the Catalog implementation to use the underlying FileSystem.
|
static class |
CatalogResolver.CatalogManager
Extend the CatalogManager to make the FileSystem and base directory accessible.
|
Modifier and Type | Field and Description |
---|---|
protected FileSystem |
fs
The FileSystem in use.
|
protected CatalogResolver.CatalogManager |
manager
The CatalogManager
|
Constructor and Description |
---|
CatalogResolver()
Constructs the CatalogResolver
|
Modifier and Type | Method and Description |
---|---|
org.apache.commons.logging.Log |
getLogger()
Returns the logger used by this configuration object.
|
InputSource |
resolveEntity(String publicId,
String systemId)
Implements the
resolveEntity method
for the SAX interface. |
void |
setBaseDir(String baseDir)
Set the base path.
|
void |
setCatalogFiles(String catalogs)
Set the list of catalog file names
|
void |
setDebug(boolean debug)
Enables debug logging of xml-commons Catalog processing.
|
void |
setFileSystem(FileSystem fileSystem)
Set the FileSystem.
|
void |
setLogger(org.apache.commons.logging.Log log)
Allows to set the logger to be used by this configuration object.
|
void |
setSubstitutor(org.apache.commons.lang.text.StrSubstitutor substitutor)
Set the StrSubstitutor.
|
protected CatalogResolver.CatalogManager manager
protected FileSystem fs
public void setCatalogFiles(String catalogs)
catalogs
- The delimited list of catalog files.public void setFileSystem(FileSystem fileSystem)
fileSystem
- The FileSystem.public void setBaseDir(String baseDir)
baseDir
- The base path String.public void setSubstitutor(org.apache.commons.lang.text.StrSubstitutor substitutor)
substitutor
- The StrSubstitutor.public void setDebug(boolean debug)
debug
- True if debugging should be enabled, false otherwise.public InputSource resolveEntity(String publicId, String systemId) throws SAXException
resolveEntity
method
for the SAX interface.
Presented with an optional public identifier and a system identifier, this function attempts to locate a mapping in the catalogs.
If such a mapping is found, the resolver attempts to open the mapped value as an InputSource and return it. Exceptions are ignored and null is returned if the mapped value cannot be opened as an input source.
If no mapping is found (or an error occurs attempting to open the mapped value as an input source), null is returned and the system will use the specified system identifier as if no entityResolver was specified.
resolveEntity
in interface EntityResolver
publicId
- The public identifier for the entity in question.
This may be null.systemId
- The system identifier for the entity in question.
XML requires a system identifier on all external entities, so this
value is always specified.SAXException
- if an error occurs.public org.apache.commons.logging.Log getLogger()
public void setLogger(org.apache.commons.logging.Log log)
log
- the new loggerCopyright © 2001–2013 The Apache Software Foundation. All rights reserved.