Package org.xmlresolver.loaders
Class ValidatingXmlLoader
java.lang.Object
org.xmlresolver.loaders.ValidatingXmlLoader
- All Implemented Interfaces:
CatalogLoader
A validating catalog loader.
This loader will raise an exception if the catalog file cannot be read, is not
well-formed XML, or is not valid according to the XML Catalogs 1.1 schema.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final HashMap
<URI, EntryCatalog> protected final ResolverConfiguration
protected final ResolverLogger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Return whether archived catalogs are allowed.Return the entity resolver used when loading catalogs.boolean
Return the current "prefer public" status.loadCatalog
(URI catalog) Load the specified catalog.loadCatalog
(URI catalog, InputSource source) Load the specified catalog from the specified stream.loadCatalog
(URI catalog, SaxProducer producer) Load the specified catalog from the specified stream.void
setArchivedCatalogs
(boolean allow) Allow archived catalogs on the catalog path.void
setEntityResolver
(EntityResolver resolver) Set the entity resolver used when loading catalogs.void
setPreferPublic
(boolean prefer) Set the default "prefer public" status for this catalog.
-
Field Details
-
config
-
logger
-
catalogMap
-
-
Constructor Details
-
ValidatingXmlLoader
-
-
Method Details
-
setEntityResolver
Description copied from interface:CatalogLoader
Set the entity resolver used when loading catalogs.When the resolver loads a catalog, it can't use itself as the entity resolver because that would cause an infinite loop. Instead, it uses this resolver. The only entities that this resolver needs to be able to handle are the ones used in document type declarations for the catalogs themselves.
- Specified by:
setEntityResolver
in interfaceCatalogLoader
- Parameters:
resolver
- the resolver
-
getEntityResolver
Description copied from interface:CatalogLoader
Return the entity resolver used when loading catalogs.- Specified by:
getEntityResolver
in interfaceCatalogLoader
- Returns:
- resolver the resolver
-
loadCatalog
Load the specified catalog.- Specified by:
loadCatalog
in interfaceCatalogLoader
- Parameters:
catalog
- The catalog URI.- Returns:
- The parsed catalog, if it was available and valid.
- Throws:
CatalogUnavailableException
- if the catalog could not be read.CatalogInvalidException
- if the catalog is invalid.
-
loadCatalog
Load the specified catalog from the specified stream.- Specified by:
loadCatalog
in interfaceCatalogLoader
- Parameters:
catalog
- The catalog URI.source
- The input source.- Returns:
- The parsed catalog, if it was available and valid.
- Throws:
CatalogInvalidException
- if the catalog is invalid.
-
loadCatalog
Load the specified catalog from the specified stream.- Specified by:
loadCatalog
in interfaceCatalogLoader
- Parameters:
catalog
- The catalog URI.producer
- The producer that delivers events to the ContentHandler.- Returns:
- The parsed catalog.
- Throws:
CatalogInvalidException
- if the catalog is invalid.
-
setPreferPublic
public void setPreferPublic(boolean prefer) Description copied from interface:CatalogLoader
Set the default "prefer public" status for this catalog.- Specified by:
setPreferPublic
in interfaceCatalogLoader
- Parameters:
prefer
- True if public identifiers are to be preferred.
-
getPreferPublic
public boolean getPreferPublic()Description copied from interface:CatalogLoader
Return the current "prefer public" status.- Specified by:
getPreferPublic
in interfaceCatalogLoader
- Returns:
- The current "prefer public" status of this catalog loader.
-
setArchivedCatalogs
public void setArchivedCatalogs(boolean allow) Description copied from interface:CatalogLoader
Allow archived catalogs on the catalog path.If allowed, then ZIP files may be specified as catalogs. The loader will return the catalog associated with the
/catalog.xml
or/org/xmlresolver/catalog.xml
within the ZIP file.- Specified by:
setArchivedCatalogs
in interfaceCatalogLoader
- Parameters:
allow
- True if archived catalogs are to be allowed.
-
getArchivedCatalogs
public boolean getArchivedCatalogs()Description copied from interface:CatalogLoader
Return whether archived catalogs are allowed.- Specified by:
getArchivedCatalogs
in interfaceCatalogLoader
- Returns:
- True if archived catalogs are allowed.
-