Class 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.
    • Method Summary

      All Methods Instance Methods Concrete 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 the specified stream.
      void setArchivedCatalogs​(boolean allow)
      Allow archived catalogs on the catalog path.
      void setPreferPublic​(boolean prefer)
      Set the default "prefer public" status for this catalog.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • loadCatalog

        public org.xmlresolver.catalog.entry.EntryCatalog loadCatalog​(java.net.URI catalog)
        Load the specified catalog.
        Specified by:
        loadCatalog in interface CatalogLoader
        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:
        loadCatalog in interface CatalogLoader
        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.
      • setPreferPublic

        public void setPreferPublic​(boolean prefer)
        Description copied from interface: CatalogLoader
        Set the default "prefer public" status for this catalog.
        Specified by:
        setPreferPublic in interface CatalogLoader
        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 interface CatalogLoader
        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 interface CatalogLoader
        Parameters:
        allow - True if archived catalogs are to be allowed.
      • getArchivedCatalogs

        public boolean getArchivedCatalogs()
        Description copied from interface: CatalogLoader
        Return whether or not archived catalogs are allowed.
        Specified by:
        getArchivedCatalogs in interface CatalogLoader
        Returns:
        True if archived catalogs are allowed.