Interface CatalogLoader

All Known Implementing Classes:
ValidatingXmlLoader, XmlLoader

public interface CatalogLoader
The catalog loader interface.

The loader interface provides two entry points to load catalogs, one with a URI and one with both a URI and an input source (in case the catalog comes from some source that cannot be directly accessed by a URI, or the URI is unknown).

The catalog specification mandates that it must be possible to specify the default "prefer public" behavior of any catalog, so that is supported as well.

  • Method Details

    • loadCatalog

      EntryCatalog loadCatalog(URI catalog)
      Load the specified catalog.

      The manager maintains a set of the catalogs that it has loaded. If an attempt is made to load a catalog twice, the previously loaded catalog is returned.

      Parameters:
      catalog - The catalog URI.
      Returns:
      The parsed catalog.
    • loadCatalog

      EntryCatalog loadCatalog(URI catalog, InputSource source)
      Load the specified catalog from a given input source.

      This method exists so that a catalog can be loaded even if it doesn't have a URI that can be dereferenced. It must still have a URI.

      The manager maintains a set of the catalogs that it has loaded. If an attempt is made to load a catalog twice, the previously loaded catalog is returned.

      Parameters:
      catalog - The catalog URI.
      source - The input source.
      Returns:
      The parsed catalog.
    • setPreferPublic

      void setPreferPublic(boolean prefer)
      Set the default "prefer public" status for this catalog.
      Parameters:
      prefer - True if public identifiers are to be preferred.
    • getPreferPublic

      boolean getPreferPublic()
      Return the current "prefer public" status.
      Returns:
      The current "prefer public" status of this catalog loader.
    • setArchivedCatalogs

      void setArchivedCatalogs(boolean allow)
      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.

      Parameters:
      allow - True if archived catalogs are to be allowed.
    • getArchivedCatalogs

      boolean getArchivedCatalogs()
      Return whether archived catalogs are allowed.
      Returns:
      True if archived catalogs are allowed.
    • setEntityResolver

      void setEntityResolver(EntityResolver resolver)
      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.

      Parameters:
      resolver - the resolver
    • getEntityResolver

      EntityResolver getEntityResolver()
      Return the entity resolver used when loading catalogs.
      Returns:
      resolver the resolver