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 Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean getArchivedCatalogs()
      Return whether or not archived catalogs are allowed.
      boolean getPreferPublic()
      Return the current "prefer public" status.
      org.xmlresolver.catalog.entry.EntryCatalog loadCatalog​(java.net.URI catalog)
      Load the specified catalog.
      org.xmlresolver.catalog.entry.EntryCatalog loadCatalog​(java.net.URI catalog, org.xml.sax.InputSource source)
      Load the specified catalog from a given input source.
      void setArchivedCatalogs​(boolean allow)
      Allow archived catalogs on the catalog path.
      void setPreferPublic​(boolean prefer)
      Set the default "prefer public" status for this catalog.
    • Method Detail

      • loadCatalog

        org.xmlresolver.catalog.entry.EntryCatalog loadCatalog​(java.net.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

        org.xmlresolver.catalog.entry.EntryCatalog loadCatalog​(java.net.URI catalog,
                                                               org.xml.sax.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 or not archived catalogs are allowed.
        Returns:
        True if archived catalogs are allowed.