com.verisign.epp.util

## Class EPPSchemaCachingEntityResolver

- java.lang.Object
- - com.verisign.epp.util.EPPSchemaCachingEntityResolver

- All Implemented Interfaces:
    org.apache.xerces.xni.parser.XMLEntityResolver, org.xml.sax.EntityResolver

      public class EPPSchemaCachingEntityResolver
      extends java.lang.Object
      implements org.apache.xerces.xni.parser.XMLEntityResolver, org.xml.sax.EntityResolver

  EPPSchemaCachingEntityResolver is the entity resolver that goes with EPPSchemaCachingParser. It supports caching schemas for the parser instance and looking up schema instances in the Classpath.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EPPSchemaCachingEntityResolver(EPPSchemaCacher aSchemaCache)` Create a new instance of EPPSchemaCachingEntityResolver.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.xml.sax.InputSource` | `resolveEntity(java.lang.String aPublicId, java.lang.String aSystemId)` Resolves the entity passed in when parsing the instance document.
    `org.apache.xerces.xni.parser.XMLInputSource` | `resolveEntity(org.apache.xerces.xni.XMLResourceIdentifier aResourceIdentifier)` Implemented because of the XNI interface.

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

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

- - ### Constructor Detail

    - #### EPPSchemaCachingEntityResolver

          public EPPSchemaCachingEntityResolver(EPPSchemaCacher aSchemaCache)

      Create a new instance of EPPSchemaCachingEntityResolver. Resolves XML Schemas by looking them up in the classpath. As a param takes an instance of EPPSchemaCacher to call back on to cache a schema once it loads it.
      Parameters:
        `aSchemaCache` - An instance of EPPSchemaCacher to call back on to cache a schema once it loads it.

  - ### Method Detail

    - #### resolveEntity

          public org.xml.sax.InputSource resolveEntity(java.lang.String aPublicId,
                                                       java.lang.String aSystemId)
                                                throws org.xml.sax.SAXException,
                                                       java.io.IOException

      Resolves the entity passed in when parsing the instance document. Will try to find the schema from the classpath.
      Specified by:
        `resolveEntity` in interface `org.xml.sax.EntityResolver`
      Parameters:
        `aPublicId` - Public identifier of entity
        `aSystemId` - System identifier of entity
      Returns:
        XML schema associated with the entity
      Throws:
        `org.xml.sax.SAXException` - Error locating the XML schema
        `java.io.IOException` - Other error
        `org.apache.xerces.xni.XNIException` - Error parsing the XML schema

    - #### resolveEntity

          public org.apache.xerces.xni.parser.XMLInputSource resolveEntity(org.apache.xerces.xni.XMLResourceIdentifier aResourceIdentifier)
                                                                    throws org.apache.xerces.xni.XNIException,
                                                                           java.io.IOException

      Implemented because of the XNI interface. The entity resolver tries to find the resource in the classpath. This interface imlementation allows this resolver to be used as either the standard EntityResolver or one that can be used by the Xerces XNI components. If the resource can't be found an exception is thrown
      Specified by:
        `resolveEntity` in interface `org.apache.xerces.xni.parser.XMLEntityResolver`
      Parameters:
        `aResourceIdentifier` - The resource identifier that should be resolved.
      Returns:
        The XMLInputSource of the resource if found. Never returns null.
      Throws:
        `org.apache.xerces.xni.XNIException` - Error resolving name instance
        `java.io.IOException` - Error loading XML schema