Package uk.ac.starlink.util
Class StarEntityResolver
- java.lang.Object
-
- uk.ac.starlink.util.StarEntityResolver
-
- All Implemented Interfaces:
org.xml.sax.EntityResolver
public class StarEntityResolver extends java.lang.Object implements org.xml.sax.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 Summary
Constructors Constructor Description StarEntityResolver(org.xml.sax.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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StarEntityResolver
getInstance()
Returns the sole instance of this class.protected java.lang.String
getLocalResource(java.lang.String publicId, java.lang.String systemId)
Returns a resource name locating the entity referenced by a given public/system ID pair.org.xml.sax.InputSource
resolveEntity(java.lang.String publicId, java.lang.String systemId)
Resolves an entity if it is one of the ones that we keep on hand.
-
-
-
Constructor Detail
-
StarEntityResolver
public StarEntityResolver(org.xml.sax.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 Detail
-
getInstance
public static StarEntityResolver getInstance()
Returns the sole instance of this class.- Returns:
- StarEntityResolver instance
-
resolveEntity
public org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException, java.io.IOException
Resolves an entity if it is one of the ones that we keep on hand.- Specified by:
resolveEntity
in interfaceorg.xml.sax.EntityResolver
- Throws:
org.xml.sax.SAXException
java.io.IOException
-
getLocalResource
protected java.lang.String getLocalResource(java.lang.String publicId, java.lang.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 IDpublicId
- the entity's public ID- Returns:
- path to the resource, or null if it is unknown
-
-