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

public Class AbstractDOMParser

extends AbstractXMLDocumentParser
Class Inheritance
Known Direct Subclasses
org.apache.xerces.parsers.DOMParser, org.apache.xerces.parsers.DOMParserImpl
Imports
java.util.Locale, .Stack, org.apache.xerces.dom.AttrImpl, .CoreDocumentImpl, .DOMErrorImpl, .DOMMessageFormatter, .DeferredDocumentImpl, .DocumentImpl, .DocumentTypeImpl, .ElementDefinitionImpl, .ElementImpl, .ElementNSImpl, .EntityImpl, .EntityReferenceImpl, .NodeImpl, .NotationImpl, .PSVIAttrNSImpl, .PSVIDocumentImpl, .PSVIElementNSImpl, .TextImpl, org.apache.xerces.impl.Constants, org.apache.xerces.impl.dv.XSSimpleType, org.apache.xerces.util.DOMErrorHandlerWrapper, org.apache.xerces.xni.Augmentations, .NamespaceContext, .QName, .XMLAttributes, .XMLLocator, .XMLResourceIdentifier, .XMLString, .XNIException, org.apache.xerces.xni.parser.XMLParserConfiguration, org.apache.xerces.xs.AttributePSVI, .ElementPSVI, .XSTypeDefinition, org.w3c.dom.Attr, .CDATASection, .Comment, .DOMError, .Document, .DocumentType, .Element, .EntityReference, .NamedNodeMap, .Node, .NodeList, .ProcessingInstruction, .Text, org.w3c.dom.ls.LSParserFilter, org.w3c.dom.traversal.NodeFilter, org.xml.sax.SAXException

This is the base class of all DOM parsers. It implements the XNI callback methods to create the DOM tree. After a successful parse of an XML document, the DOM Document object can be queried using the getDocument method. The actual pipeline is defined in parser configuration.
Authors
Arnaud Le Hors, IBM, Andy Clark, IBM, Elena Litani, IBM
Version
$Id: AbstractDOMParser.java 782187 2009-06-06 04:21:12Z mrglavas $

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
AbstractDOMParser.Abort

If the user stops the process, this exception will be thrown.

Field Summary

Modifier and TypeField and Description
protected static final String
protected static final String
CREATE_CDATA_NODES_FEATURE

Feature id: create cdata nodes.

protected static final String
CREATE_ENTITY_REF_NODES

Feature id: create entity ref nodes.

protected static final String
private static final boolean
private static final boolean
protected static final String
DEFAULT_DOCUMENT_CLASS_NAME

Default document class name.

protected static final String
DEFER_NODE_EXPANSION

Feature id: defer node expansion.

protected static final String
DOCUMENT_CLASS_NAME

Property id: document class name.

private final QName
fAttrQName

Attribute QName.

protected final Stack<E>
fBaseURIStack

Base uri stack

protected boolean
fCreateCDATANodes

Create cdata nodes.

protected boolean
fCreateEntityRefNodes

Create entity reference nodes.

protected CDATASection
protected int
protected EntityImpl
protected Node
fCurrentNode

Current node.

protected int
protected boolean
protected DeferredDocumentImpl
protected int
protected Document
fDocument

The document.

protected String
fDocumentClassName

The document class name to use.

protected CoreDocumentImpl
fDocumentImpl

The default Xerces document implementation, if used.

protected int
protected DocumentType
fDocumentType

The document type node.

protected int
protected LSParserFilter
protected DOMErrorHandlerWrapper
fErrorHandler

DOM L3 error handler

protected boolean
fFilterReject

LSParserFilter: specifies that element with given QNAME and all its children must be rejected

protected boolean
fFirstChunk

True if saw the first chunk of characters

protected boolean
fInCDATASection

True if inside CDATA section.

protected boolean
fIncludeComments

Include Comments.

protected boolean
fIncludeIgnorableWhitespace

Include ignorable whitespace.

protected boolean
protected boolean
fInDTDExternalSubset

True if inside DTD external subset.

protected boolean
fInEntityRef

LSParserFilter: true if inside entity reference

protected StringBuffer
fInternalSubset

Internal subset buffer.

private XMLLocator
fLocator

Document locator.

protected boolean
protected int
fRejectedElementDepth

LSParserFilter: tracks the element depth within a rejected subtree.

protected Node
fRoot

Root element node.

protected Stack<E>
fSkippedElemStack

LSParserFilter: store depth of skipped elements

protected boolean
fStorePSVI

Whether to store PSVI information in DOM tree.

protected final StringBuffer
fStringBuffer

Character buffer

protected static final String
INCLUDE_COMMENTS_FEATURE

Feature id: include comments.

protected static final String
INCLUDE_IGNORABLE_WHITESPACE

Feature id: include ignorable whitespace.

protected static final String
NAMESPACES

Feature id: namespace.

protected static final String
private static final String[]
RECOGNIZED_FEATURES

Recognized features.

private static final String[]
Inherited from org.apache.xerces.parsers.AbstractXMLDocumentParser:
fDocumentSourcefDTDContentModelSourcefDTDSource

Constructor Summary

AccessConstructor and Description
protected
AbstractDOMParser(XMLParserConfiguration config)

Default constructor.

Method Summary

Modifier and TypeMethod and Description
public void
public void
attributeDecl(String
The name of the element that this attribute is associated with.
elementName
,
String
The name of the attribute.
attributeName
,
String
The attribute type. This value will be one of the following: "CDATA", "ENTITY", "ENTITIES", "ENUMERATION", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", or "NOTATION".
type
,
String[]
If the type has the value "ENUMERATION" or "NOTATION", this array holds the allowed attribute values; otherwise, this array is null.
enumeration
,
String
The attribute default type. This value will be one of the following: "#FIXED", "#IMPLIED", "#REQUIRED", or null.
defaultType
,
XMLString
The attribute default value, or null if no default value is specified.
defaultValue
,
XMLString
The attribute default value with no normalization performed, or null if no default value is specified.
nonNormalizedDefaultValue
,
Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.attributeDecl.

Implements org.apache.xerces.xni.XMLDTDHandler.attributeDecl.

An attribute declaration.
public void
characters(XMLString
The content.
text
,
Augmentations
Additional information that may include infoset augmentations
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.characters.

Implements org.apache.xerces.xni.XMLDocumentHandler.characters.

Character content.
public void
comment(XMLString
The text in the comment.
text
,
Augmentations
Additional information that may include infoset augmentations
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.comment.

Implements org.apache.xerces.xni.XMLDocumentHandler.comment, org.apache.xerces.xni.XMLDTDHandler.comment.

A comment.
protected Attr
createAttrNode(QName attrQName)

protected Element
public void
doctypeDecl(String
The name of the root element.
rootElement
,
String
The public identifier if an external DTD or null if the external DTD is specified using SYSTEM.
publicId
,
String
The system identifier if an external DTD, null otherwise.
systemId
,
Augmentations
Additional information that may include infoset augmentations
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.doctypeDecl.

Implements org.apache.xerces.xni.XMLDocumentHandler.doctypeDecl.

Notifies of the presence of the DOCTYPE line in the document.
public final void
dropDocumentReferences()

Drops all references to the last DOM which was built by this parser.

public void
elementDecl(String
The name of the element.
name
,
String
The element content model.
contentModel
,
Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.elementDecl.

Implements org.apache.xerces.xni.XMLDTDHandler.elementDecl.

An element declaration.
public void
emptyElement(QName
The name of the element.
element
,
XMLAttributes
The element attributes.
attributes
,
Augmentations
Additional information that may include infoset augmentations
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement.

Implements org.apache.xerces.xni.XMLDocumentHandler.emptyElement.

An empty element.
public void
endAttlist(Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.endAttlist.

Implements org.apache.xerces.xni.XMLDTDHandler.endAttlist.

The end of an attribute list.
public void
endCDATA(Augmentations
Additional information that may include infoset augmentations
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.endCDATA.

Implements org.apache.xerces.xni.XMLDocumentHandler.endCDATA.

The end of a CDATA section.
public void
endConditional(Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.endConditional.

Implements org.apache.xerces.xni.XMLDTDHandler.endConditional.

The end of a conditional section.
public void
endDocument(Augmentations
Additional information that may include infoset augmentations
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.endDocument.

Implements org.apache.xerces.xni.XMLDocumentHandler.endDocument.

The end of the document.
public void
endDTD(Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.endDTD.

Implements org.apache.xerces.xni.XMLDTDHandler.endDTD.

The end of the DTD.
public void
endElement(QName
The name of the element.
element
,
Augmentations
Additional information that may include infoset augmentations
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.endElement.

Implements org.apache.xerces.xni.XMLDocumentHandler.endElement.

The end of an element.
public void
endExternalSubset(Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.endExternalSubset.

Implements org.apache.xerces.xni.XMLDTDHandler.endExternalSubset.

The end of the DTD external subset.
public void
endGeneralEntity(String
The name of the entity.
name
,
Augmentations
Additional information that may include infoset augmentations
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.endGeneralEntity.

Implements org.apache.xerces.xni.XMLDocumentHandler.endGeneralEntity.

This method notifies the end of a general entity.
public void
endParameterEntity(String
The name of the parameter entity.
name
,
Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.endParameterEntity.

Implements org.apache.xerces.xni.XMLDTDHandler.endParameterEntity.

This method notifies the end of a parameter entity.
public void
externalEntityDecl(String
The name of the entity. Parameter entity names start with '%', whereas the name of a general entity is just the entity name.
name
,
XMLResourceIdentifier
An object containing all location information pertinent to this notation.
identifier
,
Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.externalEntityDecl.

Implements org.apache.xerces.xni.XMLDTDHandler.externalEntityDecl.

An external entity declaration.
public Document
getDocument()

Returns the DOM document object.

protected String
getDocumentClassName()

This method retreives the name of current document class.

protected final void
handleBaseURI(Node node)

Record baseURI information for the Element (by adding xml:base attribute) or for the ProcessingInstruction (by setting a baseURI field) Non deferred DOM.

protected final void
handleBaseURI(int node)

Record baseURI information for the Element (by adding xml:base attribute) or for the ProcessingInstruction (by setting a baseURI field) Deferred DOM.

public void
ignorableWhitespace(XMLString
The ignorable whitespace.
text
,
Augmentations
Additional information that may include infoset augmentations
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.ignorableWhitespace.

Implements org.apache.xerces.xni.XMLDocumentHandler.ignorableWhitespace.

Ignorable whitespace.
public void
ignoredCharacters(XMLString
The ignored text.
text
,
Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.ignoredCharacters.

Implements org.apache.xerces.xni.XMLDTDHandler.ignoredCharacters.

Characters within an IGNORE conditional section.
public void
internalEntityDecl(String
The name of the entity. Parameter entity names start with '%', whereas the name of a general entity is just the entity name.
name
,
XMLString
The value of the entity.
text
,
XMLString
The non-normalized value of the entity. This value contains the same sequence of characters that was in the internal entity declaration, without any entity references expanded.
nonNormalizedText
,
Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.internalEntityDecl.

Implements org.apache.xerces.xni.XMLDTDHandler.internalEntityDecl.

An internal entity declaration.
public void
notationDecl(String
The name of the notation.
name
,
XMLResourceIdentifier
An object containing all location information pertinent to this notation.
identifier
,
Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.notationDecl.

Implements org.apache.xerces.xni.XMLDTDHandler.notationDecl.

A notation declaration
public void
processingInstruction(String
The target.
target
,
XMLString
The data or null if none specified.
data
,
Augmentations
Additional information that may include infoset augmentations
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.processingInstruction.

Implements org.apache.xerces.xni.XMLDocumentHandler.processingInstruction, org.apache.xerces.xni.XMLDTDHandler.processingInstruction.

A processing instruction.
public void
protected void
setCharacterData(boolean sawChars)

protected void
setDocumentClassName(String
The fully qualified class name of the document factory to use when constructing the DOM tree.
documentClassName
)

This method allows the programmer to decide which document factory to use when constructing the DOM tree.

public void
setLocale(Locale
The locale object to use for localization of messages.
locale
)

Set the locale to use for messages.

public void
startAttlist(String
The name of the element that this attribute list is associated with.
elementName
,
Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.startAttlist.

Implements org.apache.xerces.xni.XMLDTDHandler.startAttlist.

The start of an attribute list.
public void
startCDATA(Augmentations
Additional information that may include infoset augmentations
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.startCDATA.

Implements org.apache.xerces.xni.XMLDocumentHandler.startCDATA.

The start of a CDATA section.
public void
startConditional(short
The type of the conditional section. This value will either be CONDITIONAL_INCLUDE or CONDITIONAL_IGNORE.
type
,
Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.startConditional.

Implements org.apache.xerces.xni.XMLDTDHandler.startConditional.

The start of a conditional section.
public void
startDocument(XMLLocator
The system identifier of the entity if the entity is external, null otherwise.
locator
,
String
The auto-detected IANA encoding name of the entity stream. This value will be null in those situations where the entity encoding is not auto-detected (e.g. internal entities or a document entity that is parsed from a java.io.Reader).
encoding
,
NamespaceContext
The namespace context in effect at the start of this document. This object represents the current context. Implementors of this class are responsible for copying the namespace bindings from the the current context (and its parent contexts) if that information is important.
namespaceContext
,
Augmentations
Additional information that may include infoset augmentations
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.startDocument.

Implements org.apache.xerces.xni.XMLDocumentHandler.startDocument.

The start of the document.
public void
startDTD(XMLLocator
The document locator, or null if the document location cannot be reported during the parsing of the document DTD. However, it is strongly recommended that a locator be supplied that can at least report the base system identifier of the DTD.
locator
,
Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.startDTD.

Implements org.apache.xerces.xni.XMLDTDHandler.startDTD.

The start of the DTD.
public void
startElement(QName
The name of the element.
element
,
XMLAttributes
The element attributes.
attributes
,
Augmentations
Additional information that may include infoset augmentations
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.startElement.

Implements org.apache.xerces.xni.XMLDocumentHandler.startElement.

The start of an element.
public void
startExternalSubset(XMLResourceIdentifier
The resource identifier.
identifier
,
Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.startExternalSubset.

Implements org.apache.xerces.xni.XMLDTDHandler.startExternalSubset.

The start of the DTD external subset.
public void
startGeneralEntity(String
The name of the general entity.
name
,
XMLResourceIdentifier
The resource identifier.
identifier
,
String
The auto-detected IANA encoding name of the entity stream. This value will be null in those situations where the entity encoding is not auto-detected (e.g. internal entities or a document entity that is parsed from a java.io.Reader).
encoding
,
Augmentations
Additional information that may include infoset augmentations
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.startGeneralEntity.

Implements org.apache.xerces.xni.XMLDocumentHandler.startGeneralEntity.

This method notifies the start of a general entity.
public void
startParameterEntity(String
The name of the parameter entity.
name
,
XMLResourceIdentifier
The resource identifier.
identifier
,
String
The auto-detected IANA encoding name of the entity stream. This value will be null in those situations where the entity encoding is not auto-detected (e.g. internal parameter entities).
encoding
,
Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.startParameterEntity.

Implements org.apache.xerces.xni.XMLDTDHandler.startParameterEntity.

This method notifies of the start of a parameter entity.
public void
textDecl(String
The XML version, or null if not specified.
version
,
String
The IANA encoding name of the entity.
encoding
,
Augmentations
Additional information that may include infoset augmentations
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.textDecl.

Implements org.apache.xerces.xni.XMLDocumentHandler.textDecl, org.apache.xerces.xni.XMLDTDHandler.textDecl.

Notifies of the presence of a TextDecl line in an entity.
public void
unparsedEntityDecl(String
The name of the entity.
name
,
XMLResourceIdentifier
An object containing all location information pertinent to this entity.
identifier
,
String
The name of the notation.
notation
,
Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.unparsedEntityDecl.

Implements org.apache.xerces.xni.XMLDTDHandler.unparsedEntityDecl.

An unparsed entity declaration.
public void
xmlDecl(String
The XML version.
version
,
String
The IANA encoding name of the document, or null if not specified.
encoding
,
String
The standalone value, or null if not specified.
standalone
,
Augmentations
Additional information that may include infoset augmentations
augs
)

Overrides org.apache.xerces.parsers.AbstractXMLDocumentParser.xmlDecl.

Implements org.apache.xerces.xni.XMLDocumentHandler.xmlDecl.

Notifies of the presence of an XMLDecl line in the document.
Inherited from org.apache.xerces.parsers.AbstractXMLDocumentParser:
anyelementemptyendContentModelendGroupgetDocumentSourcegetDTDContentModelSourcegetDTDSourceoccurrencepcdataseparatorsetDocumentSourcesetDTDContentModelSourcesetDTDSourcestartContentModelstartGroup