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.EntityResolverProvides 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 StarEntityResolvergetInstance()Returns the sole instance of this class.protected java.lang.StringgetLocalResource(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.InputSourceresolveEntity(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.IOExceptionResolves an entity if it is one of the ones that we keep on hand.- Specified by:
resolveEntityin interfaceorg.xml.sax.EntityResolver- Throws:
org.xml.sax.SAXExceptionjava.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
-
-