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,org.w3c.dom.DOMConfiguration,org.w3c.dom.ls.LSParser
- Direct Known Subclasses:
DOMASBuilderImpl
public class DOMParserImpl extends AbstractDOMParser implements org.w3c.dom.ls.LSParser, org.w3c.dom.DOMConfiguration
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
Fields Modifier and Type Field Description protected static booleanDEBUGprotected static java.lang.StringDISALLOW_DOCTYPE_DECL_FEATUREFeature identifier: disallow docType Decls.protected static java.lang.StringDYNAMIC_VALIDATIONDynamic validationprotected booleanfBusyprotected booleanfNamespaceDeclarationsInclude namespace declaration attributes in the document.protected java.lang.StringfSchemaTypeprotected static java.lang.StringHONOUR_ALL_SCHEMALOCATIONSFeature identifier: honour all schemaLocationsprotected static java.lang.StringNAMESPACE_GROWTHFeature identifier: namespace growthprotected static java.lang.StringNAMESPACESFeature identifier: namespaces.protected static java.lang.StringNORMALIZE_DATAFeature identifier: expose schema normalized valueprotected static java.lang.StringPSVI_AUGMENTprotected static java.lang.StringSYMBOL_TABLEprotected static java.lang.StringTOLERATE_DUPLICATESFeature identifier: tolerate duplicatesprotected static java.lang.StringVALIDATION_FEATUREFeature id: validation.protected static java.lang.StringXMLSCHEMAXML Schema validationprotected static java.lang.StringXMLSCHEMA_FULL_CHECKINGXML Schema full checking-
Fields 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
-
-
Constructor Summary
Constructors Constructor Description DOMParserImpl(java.lang.String configuration, java.lang.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort()booleancanSetParameter(java.lang.String name, java.lang.Object value)booleangetAsync()booleangetBusy()org.w3c.dom.DOMConfigurationgetDomConfig()org.w3c.dom.ls.LSParserFiltergetFilter()When a filter is provided, the implementation will call out to the filter as it is constructing the DOM tree structure.java.lang.ObjectgetParameter(java.lang.String name)Look up the value of a feature or a property.org.w3c.dom.DOMStringListgetParameterNames()DOM Level 3 CR - Experimental.org.w3c.dom.Documentparse(org.w3c.dom.ls.LSInput is)Parse an XML document from a resource identified by anLSInput.org.w3c.dom.DocumentparseURI(java.lang.String uri)Parse an XML document from a location identified by an URI reference.org.w3c.dom.NodeparseWithContext(org.w3c.dom.ls.LSInput is, org.w3c.dom.Node cnode, short action)Parse an XML document or fragment from a resource identified by anLSInputand insert the content into an existing document at the position epcified with thecontextNodeandactionarguments.voidreset()Resets the parser state.voidsetFilter(org.w3c.dom.ls.LSParserFilter filter)When a filter is provided, the implementation will call out to the filter as it is constructing the DOM tree structure.voidsetParameter(java.lang.String name, java.lang.Object value)Set parameters and propertiesvoidstartElement(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 Detail
-
NAMESPACES
protected static final java.lang.String NAMESPACES
Feature identifier: namespaces.- See Also:
- Constant Field Values
-
VALIDATION_FEATURE
protected static final java.lang.String VALIDATION_FEATURE
Feature id: validation.- See Also:
- Constant Field Values
-
XMLSCHEMA
protected static final java.lang.String XMLSCHEMA
XML Schema validation- See Also:
- Constant Field Values
-
XMLSCHEMA_FULL_CHECKING
protected static final java.lang.String XMLSCHEMA_FULL_CHECKING
XML Schema full checking- See Also:
- Constant Field Values
-
DYNAMIC_VALIDATION
protected static final java.lang.String DYNAMIC_VALIDATION
Dynamic validation- See Also:
- Constant Field Values
-
NORMALIZE_DATA
protected static final java.lang.String NORMALIZE_DATA
Feature identifier: expose schema normalized value- See Also:
- Constant Field Values
-
DISALLOW_DOCTYPE_DECL_FEATURE
protected static final java.lang.String DISALLOW_DOCTYPE_DECL_FEATURE
Feature identifier: disallow docType Decls.- See Also:
- Constant Field Values
-
HONOUR_ALL_SCHEMALOCATIONS
protected static final java.lang.String HONOUR_ALL_SCHEMALOCATIONS
Feature identifier: honour all schemaLocations- See Also:
- Constant Field Values
-
NAMESPACE_GROWTH
protected static final java.lang.String NAMESPACE_GROWTH
Feature identifier: namespace growth- See Also:
- Constant Field Values
-
TOLERATE_DUPLICATES
protected static final java.lang.String TOLERATE_DUPLICATES
Feature identifier: tolerate duplicates- See Also:
- Constant Field Values
-
SYMBOL_TABLE
protected static final java.lang.String SYMBOL_TABLE
- See Also:
- Constant Field Values
-
PSVI_AUGMENT
protected static final java.lang.String PSVI_AUGMENT
- See Also:
- Constant Field Values
-
fNamespaceDeclarations
protected boolean fNamespaceDeclarations
Include namespace declaration attributes in the document.
-
fSchemaType
protected java.lang.String fSchemaType
-
fBusy
protected boolean fBusy
-
DEBUG
protected static final boolean DEBUG
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DOMParserImpl
public DOMParserImpl(java.lang.String configuration, java.lang.String schemaType)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
public DOMParserImpl(SymbolTable symbolTable)
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 Detail
-
reset
public void reset()
Resets the parser state.- Overrides:
resetin classAbstractDOMParser- Throws:
SAXException- Thrown on initialization error.
-
getDomConfig
public org.w3c.dom.DOMConfiguration getDomConfig()
- Specified by:
getDomConfigin interfaceorg.w3c.dom.ls.LSParser
-
getFilter
public org.w3c.dom.ls.LSParserFilter 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 theDOMConfigurationparameters have been applied. For example, if " validate" is set totrue, the validation is done before invoking the filter.- Specified by:
getFilterin interfaceorg.w3c.dom.ls.LSParser
-
setFilter
public void setFilter(org.w3c.dom.ls.LSParserFilter filter)
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 theDOMConfigurationparameters have been applied. For example, if " validate" is set totrue, the validation is done before invoking the filter.- Specified by:
setFilterin interfaceorg.w3c.dom.ls.LSParser
-
setParameter
public void setParameter(java.lang.String name, java.lang.Object value) throws org.w3c.dom.DOMExceptionSet parameters and properties- Specified by:
setParameterin interfaceorg.w3c.dom.DOMConfiguration- Throws:
org.w3c.dom.DOMException
-
getParameter
public java.lang.Object getParameter(java.lang.String name) throws org.w3c.dom.DOMExceptionLook up the value of a feature or a property.- Specified by:
getParameterin interfaceorg.w3c.dom.DOMConfiguration- Throws:
org.w3c.dom.DOMException
-
canSetParameter
public boolean canSetParameter(java.lang.String name, java.lang.Object value)- Specified by:
canSetParameterin interfaceorg.w3c.dom.DOMConfiguration
-
getParameterNames
public org.w3c.dom.DOMStringList getParameterNames()
DOM Level 3 CR - Experimental. The list of the parameters supported by thisDOMConfigurationobject 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:
getParameterNamesin interfaceorg.w3c.dom.DOMConfiguration
-
parseURI
public org.w3c.dom.Document parseURI(java.lang.String uri) throws org.w3c.dom.ls.LSExceptionParse 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:
parseURIin interfaceorg.w3c.dom.ls.LSParser- Throws:
org.w3c.dom.ls.LSException
-
parse
public org.w3c.dom.Document parse(org.w3c.dom.ls.LSInput is) throws org.w3c.dom.ls.LSExceptionParse an XML document from a resource identified by anLSInput.- Specified by:
parsein interfaceorg.w3c.dom.ls.LSParser- Throws:
org.w3c.dom.ls.LSException
-
parseWithContext
public org.w3c.dom.Node parseWithContext(org.w3c.dom.ls.LSInput is, org.w3c.dom.Node cnode, short action) throws org.w3c.dom.DOMException, org.w3c.dom.ls.LSExceptionParse an XML document or fragment from a resource identified by anLSInputand insert the content into an existing document at the position epcified with thecontextNodeandactionarguments. When parsing the input stream the context node is used for resolving unbound namespace prefixes.- Specified by:
parseWithContextin interfaceorg.w3c.dom.ls.LSParser- Parameters:
is- TheLSInputfrom which the source document is to be read.cnode- TheNodethat 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:
org.w3c.dom.DOMException- HIERARCHY_REQUEST_ERR: Thrown if this action results in an invalid hierarchy (i.e. a Document with more than one document element).org.w3c.dom.ls.LSException
-
getAsync
public boolean getAsync()
- Specified by:
getAsyncin interfaceorg.w3c.dom.ls.LSParser- See Also:
LSParser.getAsync()
-
getBusy
public boolean getBusy()
- Specified by:
getBusyin interfaceorg.w3c.dom.ls.LSParser- See Also:
LSParser.getBusy()
-
abort
public void abort()
- Specified by:
abortin interfaceorg.w3c.dom.ls.LSParser- Overrides:
abortin classAbstractDOMParser- See Also:
LSParser.abort()
-
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:
startElementin interfaceorg.apache.xerces.xni.XMLDocumentHandler- Overrides:
startElementin 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.
-
-