gov.llnl.babel.parsers.xml

Class DTDManager

Implemented Interfaces:
EntityResolver

public class DTDManager
extends java.lang.Object
implements 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 String
COMMENT_FILE
static String
COMMENT_PUBLIC_ID
static String
HTML_PUBLIC_ID
static 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.
InputSource
resolveEntity(String public_id, 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.

Field Details

COMMENT_FILE

public static final String COMMENT_FILE

COMMENT_PUBLIC_ID

public static final String COMMENT_PUBLIC_ID

HTML_PUBLIC_ID

public static final String HTML_PUBLIC_ID

SYMBOL_PUBLIC_ID

public static final String SYMBOL_PUBLIC_ID

Constructor Details

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 Details

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.

resolveEntity

public InputSource resolveEntity(String public_id,
                                 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.

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.