Package com.luciad.format.xml.util
Class TLcdXMLEntityResolver
java.lang.Object
com.luciad.format.xml.util.TLcdXMLEntityResolver
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable
,EntityResolver
,EntityResolver2
public class TLcdXMLEntityResolver
extends Object
implements EntityResolver, EntityResolver2, ILcdInputStreamFactoryCapable
An entity resolver which has a local cache of all XSD schemas that are available in the LuciadLightspeed distribution.
Whenever a known OGC schema is being resolved, this entity resolver will use the local copy in the class path, rather
than the system ID passed to the
resolveEntity()
method. This avoids (expensive) lookups of schemas on
remote locations.
Users can additionally register additional cached entities via the registerEntity(String, String)
method.- Since:
- 2013.1
-
Constructor Summary
ConstructorDescriptionCreates a new entity resolver, initialized with all known schemas in the LuciadLightspeed distribution.TLcdXMLEntityResolver
(Map<String, String> aEntityCache) Creates a new entity resolver, initialized with all known schemas in the LuciadLightspeed distribution, and the given set of additional entity resources. -
Method Summary
Modifier and TypeMethodDescriptiongetExternalSubset
(String aName, String aBaseURI) Returns the input stream factory that is used.void
registerEntity
(String aPublicId, String aSystemId) Registers a system ID for the given resource, where the resource can be loaded from.resolveEntity
(String aPublicId, String aSystemId) resolveEntity
(String aName, String aPublicId, String aBaseURI, String aSystemId) void
setInputStreamFactory
(ILcdInputStreamFactory aInputStreamFactory) Sets the input stream factory to be used.
-
Constructor Details
-
TLcdXMLEntityResolver
Creates a new entity resolver, initialized with all known schemas in the LuciadLightspeed distribution, and the given set of additional entity resources.- Parameters:
aEntityCache
- a map containing additional entity resources; the keys are the public ID's of the resources (e.g. XSD namespaces), the values are the corresponding system ID's where the resources can be loaded from.
-
TLcdXMLEntityResolver
public TLcdXMLEntityResolver()Creates a new entity resolver, initialized with all known schemas in the LuciadLightspeed distribution.
-
-
Method Details
-
getInputStreamFactory
Description copied from interface:ILcdInputStreamFactoryCapable
Returns the input stream factory that is used.- Specified by:
getInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Returns:
- the input stream factory that is used.
-
setInputStreamFactory
Description copied from interface:ILcdInputStreamFactoryCapable
Sets the input stream factory to be used.- Specified by:
setInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Parameters:
aInputStreamFactory
- the input stream factory to be used.
-
registerEntity
Registers a system ID for the given resource, where the resource can be loaded from. Whenever a entity is being resolved via#resolveEntity
,aSystemId
will get precedence over the system ID that is passed to theresolveEntity
method.- Parameters:
aPublicId
- the public ID (e.g. XSD namespace) of the resource.aSystemId
- the system ID where the resource can be loaded from.
-
getExternalSubset
public InputSource getExternalSubset(String aName, String aBaseURI) throws SAXException, IOException - Specified by:
getExternalSubset
in interfaceEntityResolver2
- Throws:
SAXException
IOException
-
resolveEntity
public InputSource resolveEntity(String aName, String aPublicId, String aBaseURI, String aSystemId) throws SAXException, IOException - Specified by:
resolveEntity
in interfaceEntityResolver2
- Throws:
SAXException
IOException
-
resolveEntity
public InputSource resolveEntity(String aPublicId, String aSystemId) throws SAXException, IOException - Specified by:
resolveEntity
in interfaceEntityResolver
- Throws:
SAXException
IOException
-