ptolemy.data.expr
Class XMLParser.EntityResolver

java.lang.Object
  extended by ptolemy.data.expr.XMLParser.EntityResolver
All Implemented Interfaces:
org.xml.sax.EntityResolver
Enclosing class:
XMLParser

public static class XMLParser.EntityResolver
extends java.lang.Object
implements org.xml.sax.EntityResolver

The entity resolver that tries to first load a DTD file locally, and if it is not found, looks for it on the Internet using the DTD file's system ID. The DTD file, as well as its version, is uniquely identified by its public ID.

Since:
Ptolemy II 4.0
Version:
$Id: XMLParser.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Thomas Feng
Accepted Rating:
Red (tfeng)
Proposed Rating:
Green (tfeng)

Field Summary
private static java.util.Hashtable _localResources
          The string-to-string mapping between entities' publicId's and the names of the local files in which they are stored.
 
Constructor Summary
XMLParser.EntityResolver()
           
 
Method Summary
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Resolve an entity (a DTD file) by first looking for it locally.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_localResources

private static final java.util.Hashtable _localResources
The string-to-string mapping between entities' publicId's and the names of the local files in which they are stored. The file names are relative to the path of the current class.

Constructor Detail

XMLParser.EntityResolver

public XMLParser.EntityResolver()
Method Detail

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
Resolve an entity (a DTD file) by first looking for it locally. If it is not found locally, this resolver tries to grab it from the Internet using its systemId.

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Parameters:
publicId - The public ID of the entity, for example, "-//UC Berkeley//DTD MoML 1//EN" for Ptolemy MoML 1.0.
systemId - The system ID of the entity, for example, "http://ptolemy.eecs.berkeley.edu/xml/dtd/MoML_1.dtd".
Returns:
The input source that contains the content of the DTD, or null if it cannot be loaded either locally or from the Internet.