Class DOMParserImpl
- java.lang.Object
-
- org.smooks.engine.delivery.sax.ng.org.apache.xerces.parsers.XMLParser
-
- org.smooks.engine.delivery.sax.ng.org.apache.xerces.parsers.AbstractXMLDocumentParser
-
- org.smooks.engine.delivery.sax.ng.org.apache.xerces.parsers.AbstractDOMParser
-
- org.smooks.engine.delivery.sax.ng.org.apache.xerces.parsers.DOMParserImpl
-
- All Implemented Interfaces:
XMLDocumentHandler
,XMLDTDContentModelHandler
,XMLDTDHandler
,DOMConfiguration
,LSParser
public class DOMParserImpl extends AbstractDOMParser implements LSParser, 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$
- Author:
- Pavani Mukthipudi, Sun Microsystems Inc., Elena Litani, IBM, Rahul Srivastava, Sun Microsystems Inc.
-
-
Field Summary
Fields Modifier and Type Field Description protected static boolean
DEBUG
protected static String
DISALLOW_DOCTYPE_DECL_FEATURE
Feature identifier: disallow docType Decls.protected static String
DYNAMIC_VALIDATION
Dynamic validationprotected boolean
fBusy
protected boolean
fNamespaceDeclarations
Include namespace declaration attributes in the document.protected String
fSchemaType
protected static String
HONOUR_ALL_SCHEMALOCATIONS
Feature identifier: honour all schemaLocationsprotected static String
NAMESPACE_GROWTH
Feature identifier: namespace growthprotected static String
NAMESPACES
Feature identifier: namespaces.protected static String
NORMALIZE_DATA
Feature identifier: expose schema normalized valueprotected static String
PSVI_AUGMENT
protected static String
SYMBOL_TABLE
protected static String
TOLERATE_DUPLICATES
Feature identifier: tolerate duplicatesprotected static String
VALIDATION_FEATURE
Feature id: validation.protected static String
XMLSCHEMA
XML Schema validationprotected static String
XMLSCHEMA_FULL_CHECKING
XML Schema full checking-
Fields inherited from class org.smooks.engine.delivery.sax.ng.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.smooks.engine.delivery.sax.ng.org.apache.xerces.parsers.AbstractXMLDocumentParser
fDocumentSource, fDTDContentModelSource, fDTDSource
-
Fields inherited from class org.smooks.engine.delivery.sax.ng.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.smooks.engine.delivery.sax.ng.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.smooks.engine.delivery.sax.ng.org.apache.xerces.xni.XMLDTDHandler
CONDITIONAL_IGNORE, CONDITIONAL_INCLUDE
-
-
Constructor Summary
Constructors Constructor Description DOMParserImpl(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, XMLGrammarPool grammarPool)
Constructs a DOM Builder using the specified symbol table and grammar pool.DOMParserImpl(XMLParserConfiguration config)
Constructs a DOM Builder using the specified parser configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abort()
boolean
canSetParameter(String name, Object value)
boolean
getAsync()
boolean
getBusy()
DOMConfiguration
getDomConfig()
LSParserFilter
getFilter()
When a filter is provided, the implementation will call out to the filter as it is constructing the DOM tree structure.Object
getParameter(String name)
Look up the value of a feature or a property.DOMStringList
getParameterNames()
DOM Level 3 CR - Experimental.Document
parse(LSInput is)
Parse an XML document from a resource identified by anLSInput
.Document
parseURI(String uri)
Parse an XML document from a location identified by an URI reference.Node
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(QName element, XMLAttributes attributes, Augmentations augs)
The start of an element.-
Methods inherited from class org.smooks.engine.delivery.sax.ng.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.smooks.engine.delivery.sax.ng.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 String NAMESPACES
Feature identifier: namespaces.- See Also:
- Constant Field Values
-
VALIDATION_FEATURE
protected static final String VALIDATION_FEATURE
Feature id: validation.- See Also:
- Constant Field Values
-
XMLSCHEMA
protected static final String XMLSCHEMA
XML Schema validation- See Also:
- Constant Field Values
-
XMLSCHEMA_FULL_CHECKING
protected static final String XMLSCHEMA_FULL_CHECKING
XML Schema full checking- See Also:
- Constant Field Values
-
DYNAMIC_VALIDATION
protected static final String DYNAMIC_VALIDATION
Dynamic validation- See Also:
- Constant Field Values
-
NORMALIZE_DATA
protected static final String NORMALIZE_DATA
Feature identifier: expose schema normalized value- See Also:
- Constant Field Values
-
DISALLOW_DOCTYPE_DECL_FEATURE
protected static final String DISALLOW_DOCTYPE_DECL_FEATURE
Feature identifier: disallow docType Decls.- See Also:
- Constant Field Values
-
HONOUR_ALL_SCHEMALOCATIONS
protected static final String HONOUR_ALL_SCHEMALOCATIONS
Feature identifier: honour all schemaLocations- See Also:
- Constant Field Values
-
NAMESPACE_GROWTH
protected static final String NAMESPACE_GROWTH
Feature identifier: namespace growth- See Also:
- Constant Field Values
-
TOLERATE_DUPLICATES
protected static final String TOLERATE_DUPLICATES
Feature identifier: tolerate duplicates- See Also:
- Constant Field Values
-
SYMBOL_TABLE
protected static final String SYMBOL_TABLE
- See Also:
- Constant Field Values
-
PSVI_AUGMENT
protected static final String PSVI_AUGMENT
- See Also:
- Constant Field Values
-
fNamespaceDeclarations
protected boolean fNamespaceDeclarations
Include namespace declaration attributes in the document.
-
fSchemaType
protected String fSchemaType
-
fBusy
protected boolean fBusy
-
DEBUG
protected static final boolean DEBUG
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DOMParserImpl
public DOMParserImpl(String configuration, String schemaType)
Constructs a DOM Builder using the standard parser configuration.
-
DOMParserImpl
public DOMParserImpl(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, 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:
reset
in classAbstractDOMParser
- Throws:
SAXException
- Thrown on initialization error.
-
getDomConfig
public DOMConfiguration getDomConfig()
- Specified by:
getDomConfig
in interfaceLSParser
-
getFilter
public 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 theDOMConfiguration
parameters have been applied. For example, if " validate" is set totrue
, the validation is done before invoking the filter.
-
setFilter
public 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. 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
public void setParameter(String name, Object value) throws DOMException
Set parameters and properties- Specified by:
setParameter
in interfaceDOMConfiguration
- Throws:
DOMException
-
getParameter
public Object getParameter(String name) throws DOMException
Look up the value of a feature or a property.- Specified by:
getParameter
in interfaceDOMConfiguration
- Throws:
DOMException
-
canSetParameter
public boolean canSetParameter(String name, Object value)
- Specified by:
canSetParameter
in interfaceDOMConfiguration
-
getParameterNames
public DOMStringList 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
public Document parseURI(String uri) throws LSException
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
public Document parse(LSInput is) throws LSException
Parse an XML document from a resource identified by anLSInput
.- Specified by:
parse
in interfaceLSParser
- Throws:
LSException
-
parseWithContext
public Node parseWithContext(LSInput is, Node cnode, short action) throws DOMException, LSException
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()
- Specified by:
getAsync
in interfaceLSParser
- See Also:
LSParser.getAsync()
-
getBusy
public boolean getBusy()
- Specified by:
getBusy
in interfaceLSParser
- See Also:
LSParser.getBusy()
-
abort
public void abort()
- Specified by:
abort
in interfaceLSParser
- Overrides:
abort
in classAbstractDOMParser
- See Also:
LSParser.abort()
-
startElement
public void startElement(QName element, XMLAttributes attributes, 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 interfaceXMLDocumentHandler
- Overrides:
startElement
in classAbstractDOMParser
- Parameters:
element
- The name of the element.attributes
- The element attributes.augs
- Additional information that may include infoset augmentations- Throws:
XNIException
- Thrown by handler to signal an error.
-
-