|
Préférences
Moteurs de recherche
|
|||||||||||||||||||||||||||||||||
| JavaTM 2 Platform Std. Ed. v1.5.0
org.w3c.dom.ls
|
||||||||||||||||||||||||||||||||||
| Field Summary | |
|---|---|
static short |
ACTION_APPEND_AS_CHILDREN
Append the result of the parse operation as children of the context node. |
static short |
ACTION_INSERT_AFTER
Insert the result of the parse operation as the immediately following sibling of the context node. |
static short |
ACTION_INSERT_BEFORE
Insert the result of the parse operation as the immediately preceding sibling of the context node. |
static short |
ACTION_REPLACE
Replace the context node with the result of the parse operation. |
static short |
ACTION_REPLACE_CHILDREN
Replace all the children of the context node with the result of the parse operation. |
| Method Summary | |
|---|---|
void |
abort()
Abort the loading of the document that is currently being loaded by the LSParser. |
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. |
DOMConfiguration |
getDomConfig()
The DOMConfiguration object used when parsing an input
source. |
LSParserFilter |
getFilter()
When a filter is provided, the implementation will call out to the filter as it is constructing the DOM tree structure. |
Document |
parse(LSInput input)
Parse an XML document from a resource identified by a LSInput. |
Document |
parseURI(String uri)
Parse an XML document from a location identified by a URI reference [IETF RFC 2396]. |
Node |
parseWithContext(LSInput input,
Node contextArg,
short action)
Parse an XML fragment from a resource identified by a LSInput and insert the content into an existing document
at the position specified with the context and
action arguments. |
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. |
| Field Detail |
|---|
static final short ACTION_APPEND_AS_CHILDREN
Element or a DocumentFragment.
static final short ACTION_REPLACE_CHILDREN
Element, a Document, or a
DocumentFragment.
static final short ACTION_INSERT_BEFORE
Element or a
DocumentFragment.
static final short ACTION_INSERT_AFTER
Element or a
DocumentFragment.
static final short ACTION_REPLACE
Element or a
DocumentFragment.
| Method Detail |
|---|
DOMConfiguration getDomConfig()
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"trueLSInput overrides
any encoding from the protocol. false"disallow-doctype"truefalse"ignore-unknown-character-denormalizations"truefalse"infoset"DOMConfiguration for a description of
this parameter. Unlike in [DOM Level 3 Core]
, this parameter will default to true for
LSParser. "namespaces"truefalse"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"truefalse"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.
LSParserFilter getFilter()
DOMConfiguration parameters have been applied. For
example, if "
validate" is set to true, the validation is done before invoking the
filter.
void setFilter(LSParserFilter filter)
DOMConfiguration parameters have been applied. For
example, if "
validate" is set to true, the validation is done before invoking the
filter.
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.
Document parse(LSInput input) throws DOMException, LSException
LSInput.
input - 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.
DOMException - INVALID_STATE_ERR: Raised if the LSParser's
LSParser.busy attribute is true.
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.Document parseURI(String uri) throws DOMException, LSException
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.
DOMException - INVALID_STATE_ERR: Raised if the LSParser.busy
attribute is true.
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.Node parseWithContext(LSInput input, Node contextArg, short action) throws DOMException, LSException
LSInput and insert the content into an existing document
at the position specified with the context and
action arguments. When parsing the input stream, the
context node (or its parent, depending on where the result will be
inserted) is used for resolving unbound namespace prefixes. The
context node's ownerDocument node (or the node itself if
the node of type DOCUMENT_NODE) is used to resolve
default attributes and entity references.
Document node and the action
is ACTION_REPLACE_CHILDREN, then the document that is
passed as the context node will be changed such that its
xmlEncoding, documentURI,
xmlVersion, inputEncoding,
xmlStandalone, and all other such attributes are set to
what they would be set to if the input source was parsed using
LSParser.parse().
LSParser is asynchronous (LSParser.async is
true).
ErrorHandler instance associated with the "
error-handler" parameter of the DOMConfiguration.
parseWithContext, the values of the
following configuration parameters will be ignored and their default
values will always be used instead: "
validate", "
validate-if-schema", and "
element-content-whitespace". Other parameters will be treated normally, and the parser is expected
to call the LSParserFilter just as if a whole document
was parsed.
input - The LSInput from which the source document
is to be read. The source document must be an XML fragment, i.e.
anything except a complete XML document (except in the case where
the context node of type DOCUMENT_NODE, and the action
is ACTION_REPLACE_CHILDREN), a DOCTYPE (internal
subset), entity declaration(s), notation declaration(s), or XML or
text declaration(s).contextArg - The node that is used as the context for the data
that is being parsed. This node must be a Document
node, a DocumentFragment node, or a node of a type
that is allowed as a child of an Element node, e.g. it
cannot be an Attribute node.action - This parameter describes which action should be taken
between the new set of nodes being inserted and the existing
children of the context node. The set of possible actions is
defined in ACTION_TYPES above.
DOMException - HIERARCHY_REQUEST_ERR: Raised if the content cannot replace, be
inserted before, after, or as a child of the context node (see also
Node.insertBefore or Node.replaceChild in [DOM Level 3 Core]
).
LSParser doesn't
support this method, or if the context node is of type
Document and the DOM implementation doesn't support
the replacement of the DocumentType child or
Element child.
LSParser.busy
attribute is true.
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.void abort()
LSParser. If the LSParser is currently
not busy, a call to this method does nothing.