Package org.apache.xerces.parsers
Class DOMParserImpl
java.lang.Object
org.apache.xerces.parsers.XMLParser
org.apache.xerces.parsers.AbstractXMLDocumentParser
org.apache.xerces.parsers.AbstractDOMParser
org.apache.xerces.parsers.DOMParserImpl
- All Implemented Interfaces:
org.apache.xerces.xni.XMLDocumentHandler
,org.apache.xerces.xni.XMLDTDContentModelHandler
,org.apache.xerces.xni.XMLDTDHandler
,DOMConfiguration
,LSParser
- Direct Known Subclasses:
DOMASBuilderImpl
This is Xerces DOM Builder class. It uses the abstract DOM
parser with a document scanner, a dtd scanner, and a validator, as
well as a grammar pool.
- Version:
- $Id: DOMParserImpl.java 784915 2009-06-15 18:54:11Z knoaman $
- Author:
- Pavani Mukthipudi, Sun Microsystems Inc., Elena Litani, IBM, Rahul Srivastava, Sun Microsystems Inc.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final boolean
protected static final String
Feature identifier: disallow docType Decls.protected static final String
Dynamic validationprotected boolean
protected boolean
Include namespace declaration attributes in the document.protected String
protected static final String
Feature identifier: honour all schemaLocationsprotected static final String
Feature identifier: namespace growthprotected static final String
Feature identifier: namespaces.protected static final String
Feature identifier: expose schema normalized valueprotected static final String
protected static final String
protected static final String
Feature identifier: tolerate duplicatesprotected static final String
Feature id: validation.protected static final String
XML Schema validationprotected static final String
XML Schema full checkingFields inherited from class org.apache.xerces.parsers.AbstractDOMParser
CORE_DOCUMENT_CLASS_NAME, CREATE_CDATA_NODES_FEATURE, CREATE_ENTITY_REF_NODES, CURRENT_ELEMENT_NODE, DEFAULT_DOCUMENT_CLASS_NAME, DEFER_NODE_EXPANSION, DOCUMENT_CLASS_NAME, fBaseURIStack, fCreateCDATANodes, fCreateEntityRefNodes, fCurrentCDATASection, fCurrentCDATASectionIndex, fCurrentEntityDecl, fCurrentNode, fCurrentNodeIndex, fDeferNodeExpansion, fDeferredDocumentImpl, fDeferredEntityDecl, fDocument, fDocumentClassName, fDocumentImpl, fDocumentIndex, fDocumentType, fDocumentTypeIndex, fDOMFilter, fErrorHandler, fFilterReject, fFirstChunk, fInCDATASection, fIncludeComments, fIncludeIgnorableWhitespace, fInDTD, fInDTDExternalSubset, fInEntityRef, fInternalSubset, fNamespaceAware, fRejectedElementDepth, fRoot, fSkippedElemStack, fStorePSVI, fStringBuffer, INCLUDE_COMMENTS_FEATURE, INCLUDE_IGNORABLE_WHITESPACE, PSVI_DOCUMENT_CLASS_NAME
Fields inherited from class org.apache.xerces.parsers.AbstractXMLDocumentParser
fDocumentSource, fDTDContentModelSource, fDTDSource
Fields inherited from class org.apache.xerces.parsers.XMLParser
ENTITY_RESOLVER, ERROR_HANDLER, fConfiguration
Fields inherited from interface org.w3c.dom.ls.LSParser
ACTION_APPEND_AS_CHILDREN, ACTION_INSERT_AFTER, ACTION_INSERT_BEFORE, ACTION_REPLACE, ACTION_REPLACE_CHILDREN
Fields inherited from interface org.apache.xerces.xni.XMLDTDContentModelHandler
OCCURS_ONE_OR_MORE, OCCURS_ZERO_OR_MORE, OCCURS_ZERO_OR_ONE, SEPARATOR_CHOICE, SEPARATOR_SEQUENCE
Fields inherited from interface org.apache.xerces.xni.XMLDTDHandler
CONDITIONAL_IGNORE, CONDITIONAL_INCLUDE
-
Constructor Summary
ConstructorsConstructorDescriptionDOMParserImpl
(String configuration, String schemaType) Constructs a DOM Builder using the standard parser configuration.DOMParserImpl
(SymbolTable symbolTable) Constructs a DOM Builder using the specified symbol table.DOMParserImpl
(SymbolTable symbolTable, org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool) Constructs a DOM Builder using the specified symbol table and grammar pool.DOMParserImpl
(org.apache.xerces.xni.parser.XMLParserConfiguration config) Constructs a DOM Builder using the specified parser configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoid
abort()
boolean
canSetParameter
(String name, Object value) boolean
getAsync()
boolean
getBusy()
When a filter is provided, the implementation will call out to the filter as it is constructing the DOM tree structure.getParameter
(String name) Look up the value of a feature or a property.DOM Level 3 CR - Experimental.Parse an XML document from a resource identified by anLSInput
.Parse an XML document from a location identified by an URI reference.parseWithContext
(LSInput is, Node cnode, short action) Parse an XML document or fragment from a resource identified by anLSInput
and insert the content into an existing document at the position epcified with thecontextNode
andaction
arguments.void
reset()
Resets the parser state.void
setFilter
(LSParserFilter filter) When a filter is provided, the implementation will call out to the filter as it is constructing the DOM tree structure.void
setParameter
(String name, Object value) Set parameters and propertiesvoid
startElement
(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes, org.apache.xerces.xni.Augmentations augs) The start of an element.Methods inherited from class org.apache.xerces.parsers.AbstractDOMParser
attributeDecl, characters, comment, createAttrNode, createElementNode, doctypeDecl, dropDocumentReferences, elementDecl, emptyElement, endAttlist, endCDATA, endConditional, endDocument, endDTD, endElement, endExternalSubset, endGeneralEntity, endParameterEntity, externalEntityDecl, getDocument, getDocumentClassName, handleBaseURI, handleBaseURI, ignorableWhitespace, ignoredCharacters, internalEntityDecl, notationDecl, processingInstruction, setCharacterData, setDocumentClassName, setLocale, startAttlist, startCDATA, startConditional, startDocument, startDTD, startExternalSubset, startGeneralEntity, startParameterEntity, textDecl, unparsedEntityDecl, xmlDecl
Methods inherited from class org.apache.xerces.parsers.AbstractXMLDocumentParser
any, element, empty, endContentModel, endGroup, getDocumentSource, getDTDContentModelSource, getDTDSource, occurrence, pcdata, separator, setDocumentSource, setDTDContentModelSource, setDTDSource, startContentModel, startGroup
-
Field Details
-
NAMESPACES
Feature identifier: namespaces.- See Also:
-
VALIDATION_FEATURE
Feature id: validation.- See Also:
-
XMLSCHEMA
XML Schema validation- See Also:
-
XMLSCHEMA_FULL_CHECKING
XML Schema full checking- See Also:
-
DYNAMIC_VALIDATION
Dynamic validation- See Also:
-
NORMALIZE_DATA
Feature identifier: expose schema normalized value- See Also:
-
DISALLOW_DOCTYPE_DECL_FEATURE
Feature identifier: disallow docType Decls.- See Also:
-
HONOUR_ALL_SCHEMALOCATIONS
Feature identifier: honour all schemaLocations- See Also:
-
NAMESPACE_GROWTH
Feature identifier: namespace growth- See Also:
-
TOLERATE_DUPLICATES
Feature identifier: tolerate duplicates- See Also:
-
SYMBOL_TABLE
- See Also:
-
PSVI_AUGMENT
- See Also:
-
fNamespaceDeclarations
protected boolean fNamespaceDeclarationsInclude namespace declaration attributes in the document. -
fSchemaType
-
fBusy
protected boolean fBusy -
DEBUG
protected static final boolean DEBUG- See Also:
-
-
Constructor Details
-
DOMParserImpl
Constructs a DOM Builder using the standard parser configuration. -
DOMParserImpl
public DOMParserImpl(org.apache.xerces.xni.parser.XMLParserConfiguration config) Constructs a DOM Builder using the specified parser configuration. -
DOMParserImpl
Constructs a DOM Builder using the specified symbol table. -
DOMParserImpl
public DOMParserImpl(SymbolTable symbolTable, org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool) Constructs a DOM Builder using the specified symbol table and grammar pool.
-
-
Method Details
-
reset
public void reset()Resets the parser state.- Overrides:
reset
in classAbstractDOMParser
-
getDomConfig
- Specified by:
getDomConfig
in interfaceLSParser
-
getFilter
When a filter is provided, the implementation will call out to the filter as it is constructing the DOM tree structure. The filter can choose to remove elements from the document being constructed, or to terminate the parsing early.
The filter is invoked after the operations requested by theDOMConfiguration
parameters have been applied. For example, if " validate" is set totrue
, the validation is done before invoking the filter. -
setFilter
When a filter is provided, the implementation will call out to the filter as it is constructing the DOM tree structure. The filter can choose to remove elements from the document being constructed, or to terminate the parsing early.
The filter is invoked after the operations requested by theDOMConfiguration
parameters have been applied. For example, if " validate" is set totrue
, the validation is done before invoking the filter. -
setParameter
Set parameters and properties- Specified by:
setParameter
in interfaceDOMConfiguration
- Throws:
DOMException
-
getParameter
Look up the value of a feature or a property.- Specified by:
getParameter
in interfaceDOMConfiguration
- Throws:
DOMException
-
canSetParameter
- Specified by:
canSetParameter
in interfaceDOMConfiguration
-
getParameterNames
DOM Level 3 CR - Experimental. The list of the parameters supported by thisDOMConfiguration
object and for which at least one value can be set by the application. Note that this list can also contain parameter names defined outside this specification.- Specified by:
getParameterNames
in interfaceDOMConfiguration
-
parseURI
Parse an XML document from a location identified by an URI reference. If the URI contains a fragment identifier (see section 4.1 in ), the behavior is not defined by this specification.- Specified by:
parseURI
in interfaceLSParser
- Throws:
LSException
-
parse
Parse an XML document from a resource identified by anLSInput
.- Specified by:
parse
in interfaceLSParser
- Throws:
LSException
-
parseWithContext
Parse an XML document or fragment from a resource identified by anLSInput
and insert the content into an existing document at the position epcified with thecontextNode
andaction
arguments. When parsing the input stream the context node is used for resolving unbound namespace prefixes.- Specified by:
parseWithContext
in interfaceLSParser
- Parameters:
is
- TheLSInput
from which the source document is to be read.cnode
- TheNode
that is used as the context for the data that is being parsed.action
- This parameter describes which action should be taken between the new set of node being inserted and the existing children of the context node. The set of possible actions is defined above.- Throws:
DOMException
- HIERARCHY_REQUEST_ERR: Thrown if this action results in an invalid hierarchy (i.e. a Document with more than one document element).LSException
-
getAsync
public boolean getAsync() -
getBusy
public boolean getBusy() -
abort
public void abort()- Specified by:
abort
in interfaceLSParser
- Overrides:
abort
in classAbstractDOMParser
- See Also:
-
startElement
public void startElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes, org.apache.xerces.xni.Augmentations augs) The start of an element. If the document specifies the start element by using an empty tag, then the startElement method will immediately be followed by the endElement method, with no intervening methods. Overriding the parent to handle DOM_NAMESPACE_DECLARATIONS=false.- Specified by:
startElement
in interfaceorg.apache.xerces.xni.XMLDocumentHandler
- Overrides:
startElement
in classAbstractDOMParser
- Parameters:
element
- The name of the element.attributes
- The element attributes.augs
- Additional information that may include infoset augmentations- Throws:
org.apache.xerces.xni.XNIException
- Thrown by handler to signal an error.
-