Package org.xmlresolver.loaders
Class ValidatingXmlLoader
- java.lang.Object
-
- org.xmlresolver.loaders.ValidatingXmlLoader
-
- All Implemented Interfaces:
CatalogLoader
public class ValidatingXmlLoader extends java.lang.Object implements 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.
-
-
Constructor Summary
Constructors Constructor Description ValidatingXmlLoader(ResolverConfiguration config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetArchivedCatalogs()Return whether archived catalogs are allowed.org.xml.sax.EntityResolvergetEntityResolver()Return the entity resolver used when loading catalogs.booleangetPreferPublic()Return the current "prefer public" status.org.xmlresolver.catalog.entry.EntryCatalogloadCatalog(java.net.URI catalog)Load the specified catalog.org.xmlresolver.catalog.entry.EntryCatalogloadCatalog(java.net.URI catalog, org.xml.sax.InputSource source)Load the specified catalog from the specified stream.org.xmlresolver.catalog.entry.EntryCatalogloadCatalog(java.net.URI catalog, org.xmlresolver.utils.SaxProducer producer)Load the specified catalog from the specified stream.voidsetArchivedCatalogs(boolean allow)Allow archived catalogs on the catalog path.voidsetEntityResolver(org.xml.sax.EntityResolver resolver)Set the entity resolver used when loading catalogs.voidsetPreferPublic(boolean prefer)Set the default "prefer public" status for this catalog.
-
-
-
Constructor Detail
-
ValidatingXmlLoader
public ValidatingXmlLoader(ResolverConfiguration config)
-
-
Method Detail
-
setEntityResolver
public void setEntityResolver(org.xml.sax.EntityResolver resolver)
Description copied from interface:CatalogLoaderSet 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:
setEntityResolverin interfaceCatalogLoader- Parameters:
resolver- the resolver
-
getEntityResolver
public org.xml.sax.EntityResolver getEntityResolver()
Description copied from interface:CatalogLoaderReturn the entity resolver used when loading catalogs.- Specified by:
getEntityResolverin interfaceCatalogLoader- Returns:
- resolver the resolver
-
loadCatalog
public org.xmlresolver.catalog.entry.EntryCatalog loadCatalog(java.net.URI catalog)
Load the specified catalog.- Specified by:
loadCatalogin 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
public org.xmlresolver.catalog.entry.EntryCatalog loadCatalog(java.net.URI catalog, org.xml.sax.InputSource source)Load the specified catalog from the specified stream.- Specified by:
loadCatalogin 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
public org.xmlresolver.catalog.entry.EntryCatalog loadCatalog(java.net.URI catalog, org.xmlresolver.utils.SaxProducer producer)Load the specified catalog from the specified stream.- Specified by:
loadCatalogin 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:CatalogLoaderSet the default "prefer public" status for this catalog.- Specified by:
setPreferPublicin interfaceCatalogLoader- Parameters:
prefer- True if public identifiers are to be preferred.
-
getPreferPublic
public boolean getPreferPublic()
Description copied from interface:CatalogLoaderReturn the current "prefer public" status.- Specified by:
getPreferPublicin interfaceCatalogLoader- Returns:
- The current "prefer public" status of this catalog loader.
-
setArchivedCatalogs
public void setArchivedCatalogs(boolean allow)
Description copied from interface:CatalogLoaderAllow 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.xmlor/org/xmlresolver/catalog.xmlwithin the ZIP file.- Specified by:
setArchivedCatalogsin interfaceCatalogLoader- Parameters:
allow- True if archived catalogs are to be allowed.
-
getArchivedCatalogs
public boolean getArchivedCatalogs()
Description copied from interface:CatalogLoaderReturn whether archived catalogs are allowed.- Specified by:
getArchivedCatalogsin interfaceCatalogLoader- Returns:
- True if archived catalogs are allowed.
-
-