Class StarEntityResolver

java.lang.Object
uk.ac.starlink.util.StarEntityResolver
All Implemented Interfaces:
EntityResolver

public class StarEntityResolver extends Object implements EntityResolver
Provides specialised XML entity resolution. This resolver knows about some entities which starjava applications are likely to want to retrieve; it keeps copies of them so that no network connection is required for them.

Use getInstance() to obtain an instance of this class without a parent.

Author:
Mark Taylor (Starlink)
  • Constructor Details

    • StarEntityResolver

      public StarEntityResolver(EntityResolver parent)
      Constructs a resolver which will resolve entities this class knows about, and for those it doesn't it will defer resolution to a supplied parent resolver.
      Parameters:
      parent - fallback resolver (may be null)
  • Method Details

    • getInstance

      public static StarEntityResolver getInstance()
      Returns the sole instance of this class.
      Returns:
      StarEntityResolver instance
    • resolveEntity

      public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
      Resolves an entity if it is one of the ones that we keep on hand.
      Specified by:
      resolveEntity in interface EntityResolver
      Throws:
      SAXException
      IOException
    • getLocalResource

      protected String getLocalResource(String publicId, String systemId)
      Returns a resource name locating the entity referenced by a given public/system ID pair. If there is a local copy of this entity, its path relative to this class is returned, otherwise null is returned.
      Parameters:
      systemId - the entity's system ID
      publicId - the entity's public ID
      Returns:
      path to the resource, or null if it is unknown