public class

DOMParser

extends AbstractDOMParser
java.lang.Object
   ↳ org.apache.xerces.parsers.XMLParser
     ↳ org.apache.xerces.parsers.AbstractXMLDocumentParser
       ↳ org.apache.xerces.parsers.AbstractDOMParser
         ↳ org.apache.xerces.parsers.DOMParser

Class Overview

This is the main Xerces DOM parser class. It uses the abstract DOM parser with a document scanner, a dtd scanner, and a validator, as well as a grammar pool.

Summary

Constants
String SYMBOL_TABLE Property identifier: symbol table.
String USE_ENTITY_RESOLVER2 Feature identifier: EntityResolver2.
String XMLGRAMMAR_POOL Property identifier: XML grammar pool.
[Expand]
Inherited Constants
From class org.apache.xerces.parsers.AbstractDOMParser
From class org.apache.xerces.parsers.XMLParser
From interface org.apache.xerces.xni.XMLDTDContentModelHandler
From interface org.apache.xerces.xni.XMLDTDHandler
Fields
protected boolean fUseEntityResolver2 Use EntityResolver2.
[Expand]
Inherited Fields
From class org.apache.xerces.parsers.AbstractDOMParser
From class org.apache.xerces.parsers.AbstractXMLDocumentParser
From class org.apache.xerces.parsers.XMLParser
Public Constructors
DOMParser(XMLParserConfiguration config)
Constructs a DOM parser using the specified parser configuration.
DOMParser()
Constructs a DOM parser using the dtd/xml schema parser configuration.
DOMParser(SymbolTable symbolTable)
Constructs a DOM parser using the specified symbol table.
DOMParser(SymbolTable symbolTable, XMLGrammarPool grammarPool)
Constructs a DOM parser using the specified symbol table and grammar pool.
Public Methods
EntityResolver getEntityResolver()
Return the current entity resolver.
ErrorHandler getErrorHandler()
Return the current error handler.
boolean getFeature(String featureId)
Query the state of a feature.
Object getProperty(String propertyId)
Query the value of a property.
XMLParserConfiguration getXMLParserConfiguration()
Returns this parser's XMLParserConfiguration.
void parse(InputSource inputSource)
parse
void parse(String systemId)
Parses the input source specified by the given system identifier.
void setEntityResolver(EntityResolver resolver)
Sets the resolver used to resolve external entities.
void setErrorHandler(ErrorHandler errorHandler)
Allow an application to register an error event handler.
void setFeature(String featureId, boolean state)
Set the state of any feature in a SAX2 parser.
void setProperty(String propertyId, Object value)
Set the value of any property in a SAX2 parser.
[Expand]
Inherited Methods
From class org.apache.xerces.parsers.AbstractDOMParser
From class org.apache.xerces.parsers.AbstractXMLDocumentParser
From class org.apache.xerces.parsers.XMLParser
From class java.lang.Object
From interface org.apache.xerces.xni.XMLDTDContentModelHandler
From interface org.apache.xerces.xni.XMLDTDHandler
From interface org.apache.xerces.xni.XMLDocumentHandler

Constants

protected static final String SYMBOL_TABLE

Property identifier: symbol table.

Constant Value: "http://apache.org/xml/properties/internal/symbol-table"

protected static final String USE_ENTITY_RESOLVER2

Feature identifier: EntityResolver2.

Constant Value: "http://xml.org/sax/features/use-entity-resolver2"

protected static final String XMLGRAMMAR_POOL

Property identifier: XML grammar pool.

Constant Value: "http://apache.org/xml/properties/internal/grammar-pool"

Fields

protected boolean fUseEntityResolver2

Use EntityResolver2.

Public Constructors

public DOMParser (XMLParserConfiguration config)

Constructs a DOM parser using the specified parser configuration.

public DOMParser ()

Constructs a DOM parser using the dtd/xml schema parser configuration.

public DOMParser (SymbolTable symbolTable)

Constructs a DOM parser using the specified symbol table.

public DOMParser (SymbolTable symbolTable, XMLGrammarPool grammarPool)

Constructs a DOM parser using the specified symbol table and grammar pool.

Public Methods

public EntityResolver getEntityResolver ()

Return the current entity resolver.

Returns
  • The current entity resolver, or null if none has been registered.

public ErrorHandler getErrorHandler ()

Return the current error handler.

Returns
  • The current error handler, or null if none has been registered.

public boolean getFeature (String featureId)

Query the state of a feature. Query the current state of any feature in a SAX2 parser. The parser might not recognize the feature.

Parameters
featureId The unique identifier (URI) of the feature being set.
Returns
  • The current state of the feature.
Throws
SAXNotRecognizedException If the requested feature is not known.
SAXNotSupportedException If the requested feature is known but not supported.

public Object getProperty (String propertyId)

Query the value of a property. Return the current value of a property in a SAX2 parser. The parser might not recognize the property.

Parameters
propertyId The unique identifier (URI) of the property being set.
Returns
  • The current value of the property.
Throws
SAXNotRecognizedException If the requested property is not known.
SAXNotSupportedException If the requested property is known but not supported.

public XMLParserConfiguration getXMLParserConfiguration ()

Returns this parser's XMLParserConfiguration.

public void parse (InputSource inputSource)

parse

Throws
org.xml.sax.SAXException
IOException
SAXException

public void parse (String systemId)

Parses the input source specified by the given system identifier.

This method is equivalent to the following:

     parse(new InputSource(systemId));
 

Parameters
systemId The system identifier (URI).
Throws
SAXException Throws exception on SAX error.
IOException Throws exception on i/o error.

public void setEntityResolver (EntityResolver resolver)

Sets the resolver used to resolve external entities. The EntityResolver interface supports resolution of public and system identifiers.

Parameters
resolver The new entity resolver. Passing a null value will uninstall the currently installed resolver.

public void setErrorHandler (ErrorHandler errorHandler)

Allow an application to register an error event handler.

If the application does not register an error handler, all error events reported by the SAX parser will be silently ignored; however, normal processing may not continue. It is highly recommended that all SAX applications implement an error handler to avoid unexpected bugs.

Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.

Parameters
errorHandler The error handler.
Throws
NullPointerException If the handler argument is null.

public void setFeature (String featureId, boolean state)

Set the state of any feature in a SAX2 parser. The parser might not recognize the feature, and if it does recognize it, it might not be able to fulfill the request.

Parameters
featureId The unique identifier (URI) of the feature.
state The requested state of the feature (true or false).
Throws
SAXNotRecognizedException If the requested feature is not known.
SAXNotSupportedException If the requested feature is known, but the requested state is not supported.

public void setProperty (String propertyId, Object value)

Set the value of any property in a SAX2 parser. The parser might not recognize the property, and if it does recognize it, it might not support the requested value.

Parameters
propertyId The unique identifier (URI) of the property being set.
value The value to which the property is being set.
Throws
SAXNotRecognizedException If the requested property is not known.
SAXNotSupportedException If the requested property is known, but the requested value is not supported.