public class DOMParserImpl extends AbstractDOMParser implements org.w3c.dom.ls.LSParser, org.w3c.dom.DOMConfiguration
Modifier and Type | Field and Description |
---|---|
protected static boolean |
DEBUG |
protected static java.lang.String |
DISALLOW_DOCTYPE_DECL_FEATURE
Feature identifier: disallow docType Decls.
|
protected static java.lang.String |
DYNAMIC_VALIDATION
Dynamic validation
|
protected boolean |
fBusy |
protected boolean |
fNamespaceDeclarations
Include namespace declaration attributes in the document.
|
protected java.lang.String |
fSchemaType |
protected static java.lang.String |
HONOUR_ALL_SCHEMALOCATIONS
Feature identifier: honour all schemaLocations
|
protected static java.lang.String |
NAMESPACE_GROWTH
Feature identifier: namespace growth
|
protected static java.lang.String |
NAMESPACES
Feature identifier: namespaces.
|
protected static java.lang.String |
NORMALIZE_DATA
Feature identifier: expose schema normalized value
|
protected static java.lang.String |
PSVI_AUGMENT |
protected static java.lang.String |
SYMBOL_TABLE |
protected static java.lang.String |
TOLERATE_DUPLICATES
Feature identifier: tolerate duplicates
|
protected static java.lang.String |
VALIDATION_FEATURE
Feature id: validation.
|
protected static java.lang.String |
XMLSCHEMA
XML Schema validation
|
protected static java.lang.String |
XMLSCHEMA_FULL_CHECKING
XML Schema full checking
|
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
fDocumentSource, fDTDContentModelSource, fDTDSource
ENTITY_RESOLVER, ERROR_HANDLER, fConfiguration
ACTION_APPEND_AS_CHILDREN, ACTION_INSERT_AFTER, ACTION_INSERT_BEFORE, ACTION_REPLACE, ACTION_REPLACE_CHILDREN
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
void |
abort()
Abort the loading of the document that is currently being loaded by
the
LSParser . |
boolean |
canSetParameter(java.lang.String name,
java.lang.Object value)
Check if setting a parameter to a specific value is supported.
|
boolean |
getAsync()
true if the LSParser is asynchronous,
false if it is synchronous. |
boolean |
getBusy()
true if the LSParser is currently busy
loading a document, otherwise false . |
org.w3c.dom.DOMConfiguration |
getDomConfig()
The
DOMConfiguration object used when parsing an input
source. |
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.
|
java.lang.Object |
getParameter(java.lang.String name)
Look up the value of a feature or a property.
|
org.w3c.dom.DOMStringList |
getParameterNames()
DOM Level 3 CR - Experimental.
|
org.w3c.dom.Document |
parse(org.w3c.dom.ls.LSInput is)
Parse an XML document from a resource identified by an
LSInput . |
org.w3c.dom.Document |
parseURI(java.lang.String uri)
Parse an XML document from a location identified by an URI reference.
|
org.w3c.dom.Node |
parseWithContext(org.w3c.dom.ls.LSInput is,
org.w3c.dom.Node cnode,
short action)
Parse an XML document or fragment from a resource identified by an
LSInput and insert the content into an existing
document at the position epcified with the contextNode
and action arguments. |
void |
reset()
Resets the parser state.
|
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.
|
void |
setParameter(java.lang.String name,
java.lang.Object value)
Set parameters and properties
|
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.
|
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
any, element, empty, endContentModel, endGroup, getDocumentSource, getDTDContentModelSource, getDTDSource, occurrence, pcdata, separator, setDocumentSource, setDTDContentModelSource, setDTDSource, startContentModel, startGroup
protected static final java.lang.String NAMESPACES
protected static final java.lang.String VALIDATION_FEATURE
protected static final java.lang.String XMLSCHEMA
protected static final java.lang.String XMLSCHEMA_FULL_CHECKING
protected static final java.lang.String DYNAMIC_VALIDATION
protected static final java.lang.String NORMALIZE_DATA
protected static final java.lang.String DISALLOW_DOCTYPE_DECL_FEATURE
protected static final java.lang.String HONOUR_ALL_SCHEMALOCATIONS
protected static final java.lang.String NAMESPACE_GROWTH
protected static final java.lang.String TOLERATE_DUPLICATES
protected static final java.lang.String SYMBOL_TABLE
protected static final java.lang.String PSVI_AUGMENT
protected boolean fNamespaceDeclarations
protected java.lang.String fSchemaType
protected boolean fBusy
protected static final boolean DEBUG
public DOMParserImpl(java.lang.String configuration, java.lang.String schemaType)
public DOMParserImpl(org.apache.xerces.xni.parser.XMLParserConfiguration config)
public DOMParserImpl(SymbolTable symbolTable)
public DOMParserImpl(SymbolTable symbolTable, org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool)
public void reset()
reset
in class AbstractDOMParser
SAXException
- Thrown on initialization error.public org.w3c.dom.DOMConfiguration getDomConfig()
org.w3c.dom.ls.LSParser
DOMConfiguration
object used when parsing an input
source. This DOMConfiguration
is specific to the parse
operation. No parameter values from this DOMConfiguration
object are passed automatically to the DOMConfiguration
object on the Document
that is created, or used, by the
parse operation. The DOM application is responsible for passing any
needed parameter values from this DOMConfiguration
object to the DOMConfiguration
object referenced by the
Document
object.
DOMConfiguration
objects for LSParser
add or modify the following parameters:
"charset-overrides-xml-encoding"
true
LSInput
overrides
any encoding from the protocol. false
"disallow-doctype"
true
false
"ignore-unknown-character-denormalizations"
true
false
"infoset"
DOMConfiguration
for a description of
this parameter. Unlike in [DOM Level 3 Core]
, this parameter will default to true
for
LSParser
. "namespaces"
true
false
"resource-resolver"
LSResourceResolver
object, or null. If
the value of this parameter is not null when an external resource
(such as an external XML entity or an XML schema location) is
encountered, the implementation will request that the
LSResourceResolver
referenced in this parameter resolves
the resource. "supported-media-types-only"
true
false
"validate"
DOMConfiguration
for a description of this parameter.
Unlike in [DOM Level 3 Core]
, the processing of the internal subset is always accomplished, even
if this parameter is set to false
. "validate-if-schema"
DOMConfiguration
for a description of this parameter.
Unlike in [DOM Level 3 Core]
, the processing of the internal subset is always accomplished, even
if this parameter is set to false
. "well-formed"
DOMConfiguration
for a description of this parameter.
Unlike in [DOM Level 3 Core]
, this parameter cannot be set to false
. getDomConfig
in interface org.w3c.dom.ls.LSParser
public org.w3c.dom.ls.LSParserFilter getFilter()
DOMConfiguration
parameters have been applied. For
example, if "
validate" is set to true
, the validation is done before invoking the
filter.getFilter
in interface org.w3c.dom.ls.LSParser
public void setFilter(org.w3c.dom.ls.LSParserFilter filter)
DOMConfiguration
parameters have been applied. For
example, if "
validate" is set to true
, the validation is done before invoking the
filter.setFilter
in interface org.w3c.dom.ls.LSParser
public void setParameter(java.lang.String name, java.lang.Object value) throws org.w3c.dom.DOMException
setParameter
in interface org.w3c.dom.DOMConfiguration
name
- The name of the parameter to set.value
- The new value or null
if the user wishes to
unset the parameter. While the type of the value parameter is
defined as DOMUserData
, the object type must match the
type defined by the definition of the parameter. For example, if
the parameter is "error-handler", the value must be of type
DOMErrorHandler
.org.w3c.dom.DOMException
- NOT_FOUND_ERR: Raised when the parameter name is not recognized.
public java.lang.Object getParameter(java.lang.String name) throws org.w3c.dom.DOMException
getParameter
in interface org.w3c.dom.DOMConfiguration
name
- The name of the parameter.null
if no object has been associated or if the
parameter is not supported.org.w3c.dom.DOMException
- NOT_FOUND_ERR: Raised when the parameter name is not recognized.public boolean canSetParameter(java.lang.String name, java.lang.Object value)
org.w3c.dom.DOMConfiguration
canSetParameter
in interface org.w3c.dom.DOMConfiguration
name
- The name of the parameter to check.value
- An object. if null
, the returned value is
true
.true
if the parameter could be successfully set
to the specified value, or false
if the parameter is
not recognized or the requested value is not supported. This does
not change the current value of the parameter itself.public org.w3c.dom.DOMStringList getParameterNames()
DOMConfiguration
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.getParameterNames
in interface org.w3c.dom.DOMConfiguration
public org.w3c.dom.Document parseURI(java.lang.String uri) throws org.w3c.dom.ls.LSException
parseURI
in interface org.w3c.dom.ls.LSParser
uri
- The location of the XML document to be read.LSParser
is a synchronous
LSParser
, the newly created and populated
Document
is returned, or null
if an error
occured. If the LSParser
is asynchronous,
null
is returned since the document object may not yet
be constructed when this method returns.org.w3c.dom.ls.LSException
- PARSE_ERR: Raised if the LSParser
was unable to load
the XML document. DOM applications should attach a
DOMErrorHandler
using the parameter "
error-handler" if they wish to get details on the error.public org.w3c.dom.Document parse(org.w3c.dom.ls.LSInput is) throws org.w3c.dom.ls.LSException
LSInput
.parse
in interface org.w3c.dom.ls.LSParser
is
- The LSInput
from which the source of the
document is to be read.LSParser
is a synchronous
LSParser
, the newly created and populated
Document
is returned. If the LSParser
is
asynchronous, null
is returned since the document
object may not yet be constructed when this method returns.org.w3c.dom.ls.LSException
- PARSE_ERR: Raised if the LSParser
was unable to load
the XML document. DOM applications should attach a
DOMErrorHandler
using the parameter "
error-handler" if they wish to get details on the error.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.LSException
LSInput
and insert the content into an existing
document at the position epcified with the contextNode
and action
arguments. When parsing the input stream the
context node is used for resolving unbound namespace prefixes.parseWithContext
in interface org.w3c.dom.ls.LSParser
is
- The LSInput
from which the source
document is to be read.cnode
- The Node
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.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
- PARSE_ERR: Raised if the LSParser
was unable to load
the XML fragment. DOM applications should attach a
DOMErrorHandler
using the parameter "
error-handler" if they wish to get details on the error.public boolean getAsync()
org.w3c.dom.ls.LSParser
true
if the LSParser
is asynchronous,
false
if it is synchronous.getAsync
in interface org.w3c.dom.ls.LSParser
LSParser.getAsync()
public boolean getBusy()
org.w3c.dom.ls.LSParser
true
if the LSParser
is currently busy
loading a document, otherwise false
.getBusy
in interface org.w3c.dom.ls.LSParser
LSParser.getBusy()
public void abort()
org.w3c.dom.ls.LSParser
LSParser
. If the LSParser
is currently
not busy, a call to this method does nothing.abort
in interface org.w3c.dom.ls.LSParser
abort
in class AbstractDOMParser
LSParser.abort()
public void startElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes, org.apache.xerces.xni.Augmentations augs)
startElement
in interface org.apache.xerces.xni.XMLDocumentHandler
startElement
in class AbstractDOMParser
element
- The name of the element.attributes
- The element attributes.augs
- Additional information that may include infoset augmentationsorg.apache.xerces.xni.XNIException
- Thrown by handler to signal an error.Copyright © 1999-2022 The Apache Software Foundation. All Rights Reserved.