Top Description Fields Constructors Methods
org.apache.xerces.parsers

public Class DOMParser

extends AbstractDOMParser
Class Inheritance
Imports
java.io.CharConversionException, .IOException, org.apache.xerces.dom.DOMMessageFormatter, org.apache.xerces.impl.Constants, org.apache.xerces.util.EntityResolver2Wrapper, .EntityResolverWrapper, .ErrorHandlerWrapper, .SAXMessageFormatter, .SymbolTable, org.apache.xerces.xni.XNIException, org.apache.xerces.xni.grammars.XMLGrammarPool, org.apache.xerces.xni.parser.XMLConfigurationException, .XMLEntityResolver, .XMLErrorHandler, .XMLInputSource, .XMLParseException, .XMLParserConfiguration, org.w3c.dom.Node, org.xml.sax.EntityResolver, .ErrorHandler, .InputSource, .SAXException, .SAXNotRecognizedException, .SAXNotSupportedException, .SAXParseException, org.xml.sax.ext.EntityResolver2, org.xml.sax.helpers.LocatorImpl

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.
Authors
Arnaud Le Hors, IBM, Andy Clark, IBM
Version
$Id: DOMParser.java 699892 2008-09-28 21:08:27Z mrglavas $

Field Summary

Modifier and TypeField and Description
protected boolean
fUseEntityResolver2

Use EntityResolver2.

private static final String[]
protected static final String
SYMBOL_TABLE

Property identifier: symbol table.

protected static final String
USE_ENTITY_RESOLVER2

Feature identifier: EntityResolver2.

protected static final String
XMLGRAMMAR_POOL

Property identifier: XML grammar pool.

Inherited from org.apache.xerces.parsers.AbstractDOMParser:
CORE_DOCUMENT_CLASS_NAMECREATE_CDATA_NODES_FEATURECREATE_ENTITY_REF_NODESCURRENT_ELEMENT_NODEDEFAULT_DOCUMENT_CLASS_NAMEDEFER_NODE_EXPANSIONDOCUMENT_CLASS_NAMEfBaseURIStackfCreateCDATANodesfCreateEntityRefNodesfCurrentCDATASectionfCurrentCDATASectionIndexfCurrentEntityDeclfCurrentNodefCurrentNodeIndexfDeferNodeExpansionfDeferredDocumentImplfDeferredEntityDeclfDocumentfDocumentClassNamefDocumentImplfDocumentIndexfDocumentTypefDocumentTypeIndexfDOMFilterfErrorHandlerfFilterRejectfFirstChunkfInCDATASectionfIncludeCommentsfIncludeIgnorableWhitespacefInDTDfInDTDExternalSubsetfInEntityReffInternalSubsetfNamespaceAwarefRejectedElementDepthfRootfSkippedElemStackfStorePSVIfStringBufferINCLUDE_COMMENTS_FEATUREINCLUDE_IGNORABLE_WHITESPACENAMESPACESPSVI_DOCUMENT_CLASS_NAME

Constructor Summary

AccessConstructor and Description
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.

Method Summary

Modifier and TypeMethod and Description
public EntityResolver

Returns:

The current entity resolver, or null if none has been registered.
getEntityResolver
()

Return the current entity resolver.

public ErrorHandler

Returns:

The current error handler, or null if none has been registered.
getErrorHandler
()

Return the current error handler.

public boolean

Returns:

The current state of the feature.
getFeature
(String
The unique identifier (URI) of the feature being set.
featureId
)

Query the state of a feature.

public Object

Returns:

The current value of the property.
getProperty
(String
The unique identifier (URI) of the property being set.
propertyId
)

Query the value of a property.

public XMLParserConfiguration
getXMLParserConfiguration()

Returns this parser's XMLParserConfiguration.

public void
parse(String
The system identifier (URI).
systemId
)

Parses the input source specified by the given system identifier.

public void
parse(InputSource inputSource)

parse

public void
setEntityResolver(EntityResolver
The new entity resolver. Passing a null value will uninstall the currently installed resolver.
resolver
)

Sets the resolver used to resolve external entities.

public void
setErrorHandler(ErrorHandler
The error handler.
errorHandler
)

Allow an application to register an error event handler.

public void
setFeature(String
The unique identifier (URI) of the feature.
featureId
,
boolean
The requested state of the feature (true or false).
state
)

Set the state of any feature in a SAX2 parser.

public void
setProperty(String
The unique identifier (URI) of the property being set.
propertyId
,
Object
The value to which the property is being set.
value
)

Set the value of any property in a SAX2 parser.

Inherited from org.apache.xerces.parsers.AbstractDOMParser:
abortattributeDeclcharacterscommentcreateAttrNodecreateElementNodedoctypeDecldropDocumentReferenceselementDeclemptyElementendAttlistendCDATAendConditionalendDocumentendDTDendElementendExternalSubsetendGeneralEntityendParameterEntityexternalEntityDeclgetDocumentgetDocumentClassNamehandleBaseURIhandleBaseURIignorableWhitespaceignoredCharactersinternalEntityDeclnotationDeclprocessingInstructionresetsetCharacterDatasetDocumentClassNamesetLocalestartAttliststartCDATAstartConditionalstartDocumentstartDTDstartElementstartExternalSubsetstartGeneralEntitystartParameterEntitytextDeclunparsedEntityDeclxmlDecl

Field Detail

fUseEntityResolver2back to summary
protected boolean fUseEntityResolver2

Use EntityResolver2.

RECOGNIZED_PROPERTIESback to summary
private static final String[] RECOGNIZED_PROPERTIES

Hides org.apache.xerces.parsers.AbstractDOMParser.RECOGNIZED_PROPERTIES.

Recognized properties.

SYMBOL_TABLEback to summary
protected static final String SYMBOL_TABLE

Property identifier: symbol table.

USE_ENTITY_RESOLVER2back to summary
protected static final String USE_ENTITY_RESOLVER2

Feature identifier: EntityResolver2.

XMLGRAMMAR_POOLback to summary
protected static final String XMLGRAMMAR_POOL

Property identifier: XML grammar pool.

Constructor Detail

DOMParserback to summary
public DOMParser(XMLParserConfiguration config)

Constructs a DOM parser using the specified parser configuration.

DOMParserback to summary
public DOMParser()

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

DOMParserback to summary
public DOMParser(SymbolTable symbolTable)

Constructs a DOM parser using the specified symbol table.

DOMParserback to summary
public DOMParser(SymbolTable symbolTable, XMLGrammarPool grammarPool)

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

Method Detail

getEntityResolverback to summary
public EntityResolver getEntityResolver()

Return the current entity resolver.

Returns:EntityResolver

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

See Also
setEntityResolver
getErrorHandlerback to summary
public ErrorHandler getErrorHandler()

Return the current error handler.

Returns:ErrorHandler

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

See Also
setErrorHandler
getFeatureback to summary
public boolean getFeature(String featureId) throws SAXNotRecognizedException, SAXNotSupportedException

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:String

The unique identifier (URI) of the feature being set.

Returns:boolean

The current state of the feature.

Exceptions
SAXNotRecognizedException:
If the requested feature is not known.
SAXNotSupportedException:
If the requested feature is known but not supported.
getPropertyback to summary
public Object getProperty(String propertyId) throws SAXNotRecognizedException, SAXNotSupportedException

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:String

The unique identifier (URI) of the property being set.

Returns:Object

The current value of the property.

Exceptions
SAXNotRecognizedException:
If the requested property is not known.
SAXNotSupportedException:
If the requested property is known but not supported.
getXMLParserConfigurationback to summary
public XMLParserConfiguration getXMLParserConfiguration()

Returns this parser's XMLParserConfiguration.

parseback to summary
public void parse(String systemId) throws SAXException, IOException

Parses the input source specified by the given system identifier.

This method is equivalent to the following:

    parse(new InputSource(systemId));
Parameters
systemId:String

The system identifier (URI).

Exceptions
SAXException:
Throws exception on SAX error.
IOException:
Throws exception on i/o error.
parseback to summary
public void parse(InputSource inputSource) throws SAXException, IOException

parse

setEntityResolverback to summary
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:EntityResolver

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

setErrorHandlerback to summary
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:ErrorHandler

The error handler.

Exceptions
NullPointerException:
If the handler argument is null.
See Also
getErrorHandler
setFeatureback to summary
public void setFeature(String featureId, boolean state) throws SAXNotRecognizedException, SAXNotSupportedException

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:String

The unique identifier (URI) of the feature.

state:boolean

The requested state of the feature (true or false).

Exceptions
SAXNotRecognizedException:
If the requested feature is not known.
SAXNotSupportedException:
If the requested feature is known, but the requested state is not supported.
setPropertyback to summary
public void setProperty(String propertyId, Object value) throws SAXNotRecognizedException, SAXNotSupportedException

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:String

The unique identifier (URI) of the property being set.

value:Object

The value to which the property is being set.

Exceptions
SAXNotRecognizedException:
If the requested property is not known.
SAXNotSupportedException:
If the requested property is known, but the requested value is not supported.