Class DOMParserWrapper

java.lang.Object
  |
  +--DOMParserWrapper

public class DOMParserWrapper
extends java.lang.Object

This class wraps the DOM parser, with integrated transparent name resolution through the Catalog class. This wrapper will make it simpler to migrate to JAXP or to change parser features.

Version:
$03/08/26 18:46:06 mdh$
Author:
Malcolm D. Hyman

Field Summary
static java.lang.String FEATURE_CREATE_ENTITY_REF_NODES
           
static java.lang.String FEATURE_VALIDATION
           
 
Constructor Summary
DOMParserWrapper()
           
 
Method Summary
static Catalog getCatalog()
          Returns the catalog.
static org.apache.xerces.parsers.DOMParser getParser()
          Returns the DOM parser.
static void initialize()
          Initializes the parser.
static void loadCatalog(java.lang.String loc, ArborAgent agent)
          Loads the catalog file specified by the URL loc (in string form).
static void loadCatalog(java.lang.String loc, ArborAgent agent, boolean ignoreErrors)
          Loads the catalog file specified by the URL loc (in string form).
static org.w3c.dom.Document parseDocument(java.lang.String loc, ArborAgent agent)
          Parses the XML file at loc and returns the DOM Document.
static org.w3c.dom.Document parseDocument(java.net.URL url, ArborAgent agent)
          Parses the XML file at url and returns the DOM Document.
static java.util.Map retrieveEntityValueMapFor(org.w3c.dom.Document doc)
          Retrieves the entity value map for a parsed document, and clears reference held in realEntities hash.
static void setErrorHandler(org.xml.sax.ErrorHandler err)
          Sets the error handler used by the DOM parser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FEATURE_VALIDATION

public static final java.lang.String FEATURE_VALIDATION

FEATURE_CREATE_ENTITY_REF_NODES

public static final java.lang.String FEATURE_CREATE_ENTITY_REF_NODES
Constructor Detail

DOMParserWrapper

public DOMParserWrapper()
Method Detail

initialize

public static void initialize()
Initializes the parser.

loadCatalog

public static void loadCatalog(java.lang.String loc,
                               ArborAgent agent)
Loads the catalog file specified by the URL loc (in string form).
Parameters:
loc - catalog URL
agent - ArborAgent

loadCatalog

public static void loadCatalog(java.lang.String loc,
                               ArborAgent agent,
                               boolean ignoreErrors)
Loads the catalog file specified by the URL loc (in string form).
Parameters:
loc - catalog URL
agent - ArborAgent
ignoreErrors - keep silent about errors

setErrorHandler

public static void setErrorHandler(org.xml.sax.ErrorHandler err)
Sets the error handler used by the DOM parser.
Parameters:
err - error handler

getParser

public static org.apache.xerces.parsers.DOMParser getParser()
Returns the DOM parser.
Returns:
DOM parser

getCatalog

public static Catalog getCatalog()
Returns the catalog.
Returns:
DOM parser

parseDocument

public static org.w3c.dom.Document parseDocument(java.lang.String loc,
                                                 ArborAgent agent)
                                          throws org.xml.sax.SAXException,
                                                 java.io.IOException
Parses the XML file at loc and returns the DOM Document.
Parameters:
loc - location of XML file
agent - ArborAgent
Returns:
Document object

parseDocument

public static org.w3c.dom.Document parseDocument(java.net.URL url,
                                                 ArborAgent agent)
                                          throws org.xml.sax.SAXException,
                                                 java.io.IOException,
                                                 java.net.MalformedURLException
Parses the XML file at url and returns the DOM Document.
Parameters:
url - location of XML file
agent - ArborAgent
Returns:
Document object

retrieveEntityValueMapFor

public static java.util.Map retrieveEntityValueMapFor(org.w3c.dom.Document doc)
Retrieves the entity value map for a parsed document, and clears reference held in realEntities hash.
Parameters:
doc - DOM
Returns:
entity value map