gov.llnl.babel.parsers.xml
Class DTDManager

java.lang.Object
  extended by gov.llnl.babel.parsers.xml.DTDManager
All Implemented Interfaces:
org.xml.sax.EntityResolver

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

DTDManager is a singleton class that manages the DTDs for the sidl symbol, comment, and HTML descriptions needed to parse sidl symbols in XML format. If the application does not explicitly set the path to the sidl DTDs, the the DTD manager will query the system property "gov.llnl.babel.sidl.DTDPath". This manager also defines the PUBLIC identifiers for symbol and comment DTDs used to validate SIXL XML symbols. The PUBLIC symbol identifier is "-//CCA/sidl Symbol DTD v1.0//EN" and the HTML lite comment identifier is "-//CCA/sidl HTML DTD v1.0//EN". The DTD manager object can act as a symbol resolver for a SAX parser to interpret these PUBLIC identifiers.


Field Summary
static java.lang.String COMMENT_FILE
           
static java.lang.String COMMENT_PUBLIC_ID
           
static java.lang.String HTML_PUBLIC_ID
           
static java.lang.String SYMBOL_PUBLIC_ID
           
 
Constructor Summary
DTDManager()
          Create a new instance of the DTD manager.
 
Method Summary
static DTDManager getInstance()
          Return the singleton instance of the DTD manager.
 org.xml.sax.InputSource resolveEntity(java.lang.String public_id, java.lang.String system_id)
          Provide the implementation of an EntityResolver to convert the symbol PUBLIC identifier into a URL for the symbol DTD.
static void setInstance(DTDManager instance)
          Set the singleton instance of the DTD manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYMBOL_PUBLIC_ID

public static final java.lang.String SYMBOL_PUBLIC_ID
See Also:
Constant Field Values

HTML_PUBLIC_ID

public static final java.lang.String HTML_PUBLIC_ID
See Also:
Constant Field Values

COMMENT_PUBLIC_ID

public static final java.lang.String COMMENT_PUBLIC_ID
See Also:
Constant Field Values

COMMENT_FILE

public static final java.lang.String COMMENT_FILE
See Also:
Constant Field Values
Constructor Detail

DTDManager

public DTDManager()
Create a new instance of the DTD manager. Although singleton classes do not typically define a public constructor, this implementation does so to support multiple DTD managers in the same application. Most implementations, however, will not directly create a DTD manager through the constructor and will instead use the singleton functions getInstance and setInstance.

Method Detail

getInstance

public static DTDManager getInstance()
Return the singleton instance of the DTD manager. If the symbol table instance has not yet been created, then it will be created by this call.


setInstance

public static void setInstance(DTDManager instance)
Set the singleton instance of the DTD manager. Use this function only if you want to change the default DTD manager implementation or use multiple DTD managers in the same application. Otherwise, getInstance will automatically create the DTD manager for you.


resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String public_id,
                                             java.lang.String system_id)
                                      throws java.io.IOException
Provide the implementation of an EntityResolver to convert the symbol PUBLIC identifier into a URL for the symbol DTD.

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Throws:
java.io.IOException