ApacheCatalogResolver (Apache Ant API)
Date: 2016-04-09

org.apache.tools.ant.types.resolver

## Class ApacheCatalogResolver

- java.lang.Object
- - org.apache.xml.resolver.tools.CatalogResolver
  - - org.apache.tools.ant.types.resolver.ApacheCatalogResolver

- All Implemented Interfaces:
    javax.xml.transform.URIResolver, org.xml.sax.EntityResolver

      public class ApacheCatalogResolver
      extends org.apache.xml.resolver.tools.CatalogResolver

  This class extends the CatalogResolver class provided by Norman Walsh's resolver library in xml-commons. It provides the bridge between the Ant XMLCatalog datatype and the xml-commons Catalog class. XMLCatalog calls methods in this class using Reflection in order to avoid requiring the xml-commons resolver library in the path.

  The `ApacheCatalog` class is used to parse external catalog files, which can be in either plain text format or XML format.

  For each entry found in an external catalog file, if any, an instance of `ResourceLocation` is created and added to the controlling XMLCatalog datatype. In this way, these entries will be included in XMLCatalog's lookup algorithm. See XMLCatalog.java for more details.

  Since:
    Ant 1.6
  See Also:
    `XMLCatalog.CatalogResolver`, `CatalogManager`

- - ### Field Summary

    - ### Fields inherited from class org.apache.xml.resolver.tools.CatalogResolver

      `namespaceAware, validating`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ApacheCatalogResolver()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addPublicEntry(java.lang.String publicid, java.lang.String systemid, java.net.URL base)` Add a PUBLIC catalog entry to the controlling XMLCatalog instance.
    `void` | `addURIEntry(java.lang.String uri, java.lang.String altURI, java.net.URL base)` Add a URI catalog entry to the controlling XMLCatalog instance.
    `void` | `parseCatalog(java.lang.String file)` XMLCatalog calls this to add an external catalog file for each file within a `<catalogfiles>` fileset.
    `void` | `setXMLCatalog(XMLCatalog xmlCatalog)` Set the XMLCatalog object to callback.

    - ### Methods inherited from class org.apache.xml.resolver.tools.CatalogResolver

      `getCatalog, getResolvedEntity, resolve, resolveEntity`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ApacheCatalogResolver

          public ApacheCatalogResolver()

  - ### Method Detail

    - #### setXMLCatalog

          public void setXMLCatalog(XMLCatalog xmlCatalog)

      Set the XMLCatalog object to callback.
      Parameters:
        `xmlCatalog` - the XMLCatalog to use.

    - #### parseCatalog

          public void parseCatalog(java.lang.String file)

      XMLCatalog calls this to add an external catalog file for each file within a `<catalogfiles>` fileset.
      Parameters:
        `file` - the external catalog file.

    - #### addPublicEntry

          public void addPublicEntry(java.lang.String publicid,
                            java.lang.String systemid,
                            java.net.URL base)

      Add a PUBLIC catalog entry to the controlling XMLCatalog instance. ApacheCatalog calls this for each PUBLIC entry found in an external catalog file.

      Parameters:
        `publicid` - The public ID of the resource
        `systemid` - The system ID (aka location) of the resource
        `base` - The base URL of the resource. If the systemid specifies a relative URL/pathname, it is resolved using the base. The default base for an external catalog file is the directory in which the catalog is located.

    - #### addURIEntry

          public void addURIEntry(java.lang.String uri,
                         java.lang.String altURI,
                         java.net.URL base)

      Add a URI catalog entry to the controlling XMLCatalog instance. ApacheCatalog calls this for each URI entry found in an external catalog file.

      Parameters:
        `uri` - The URI of the resource
        `altURI` - The URI to which the resource should be mapped (aka the location)
        `base` - The base URL of the resource. If the altURI specifies a relative URL/pathname, it is resolved using the base. The default base for an external catalog file is the directory in which the catalog is located.