public class DTMNodeProxy extends java.lang.Object implements Node, Document, Text, Element, Attr, ProcessingInstruction, Comment, DocumentFragment
DTMNodeProxy
presents a DOM Node API front-end to the DTM model.
It does _not_ attempt to address the "node identity" question; no effort is made to prevent the creation of multiple proxies referring to a single DTM node. Users can create a mechanism for managing this, or relinquish the use of "==" and use the .sameNodeAs() mechanism, which is under consideration for future versions of the DOM.
DTMNodeProxy may be subclassed further to present specific DOM node types.
org.w3c.dom
Constructor and Description |
---|
DTMNodeProxy(DTM dtm,
int node)
Create a DTMNodeProxy Node representing a specific Node in a DTM
|
Modifier and Type | Method and Description |
---|---|
Node |
adoptNode(Node source)
NEEDSDOC Method adoptNode
NEEDSDOC @param source
|
Node |
appendChild(Node newChild)
Adds the node
newChild to the end of the list of children
of this node. |
void |
appendData(java.lang.String arg)
Append the string to the end of the character data of the node.
|
Node |
cloneNode(boolean deep)
Returns a duplicate of this node, i.e., serves as a generic copy
constructor for nodes.
|
short |
compareDocumentPosition(Node other)
Compares a node with this node with regard to their position in the
document.
|
Attr |
createAttribute(java.lang.String name)
Creates an
Attr of the given name. |
Attr |
createAttributeNS(java.lang.String namespaceURI,
java.lang.String qualifiedName)
Creates an attribute of the given qualified name and namespace URI.
|
CDATASection |
createCDATASection(java.lang.String data)
Creates a
CDATASection node whose value is the specified
string. |
Comment |
createComment(java.lang.String data)
Creates a
Comment node given the specified string. |
DocumentFragment |
createDocumentFragment()
Creates an empty
DocumentFragment object. |
Element |
createElement(java.lang.String tagName)
Creates an element of the type specified.
|
Element |
createElementNS(java.lang.String namespaceURI,
java.lang.String qualifiedName)
Creates an element of the given qualified name and namespace URI.
|
EntityReference |
createEntityReference(java.lang.String name)
Creates an
EntityReference object. |
ProcessingInstruction |
createProcessingInstruction(java.lang.String target,
java.lang.String data)
Creates a
ProcessingInstruction node given the specified
name and data strings. |
Text |
createTextNode(java.lang.String data)
Creates a
Text node given the specified string. |
void |
deleteData(int offset,
int count)
Remove a range of 16-bit units from the node.
|
boolean |
equals(Node node)
Test for equality based on node number.
|
boolean |
equals(java.lang.Object node)
Test for equality based on node number.
|
java.lang.String |
getActualEncoding()
DOM Level 3
An attribute specifying the actual encoding of this document.
|
java.lang.String |
getAttribute(java.lang.String name)
Retrieves an attribute value by name.
|
Attr |
getAttributeNode(java.lang.String name)
Retrieves an attribute node by name.
|
Attr |
getAttributeNodeNS(java.lang.String namespaceURI,
java.lang.String localName)
Retrieves an
Attr node by local name and namespace URI. |
java.lang.String |
getAttributeNS(java.lang.String namespaceURI,
java.lang.String localName)
Retrieves an attribute value by local name and namespace URI.
|
NamedNodeMap |
getAttributes()
A
NamedNodeMap containing the attributes of this node (if
it is an Element ) or null otherwise. |
java.lang.String |
getBaseURI()
The absolute base URI of this node or
null if undefined. |
NodeList |
getChildNodes()
A
NodeList that contains all children of this node. |
java.lang.String |
getData()
The character data of the node that implements this interface.
|
DocumentType |
getDoctype()
The Document Type Declaration (see
DocumentType )
associated with this document. |
Element |
getDocumentElement()
This is a bit of a problem in DTM, since a DTM may be a Document
Fragment and hence not have a clear-cut Document Element.
|
java.lang.String |
getDocumentURI()
DOM Level 3
The location of the document or
null if undefined. |
DOMConfiguration |
getDomConfig()
The configuration used when
Document.normalizeDocument is
invoked. |
DTM |
getDTM()
NON-DOM: Return the DTM model
|
int |
getDTMNodeNumber()
NON-DOM: Return the DTM node number
|
Element |
getElementById(java.lang.String elementId)
Returns the
Element that has an ID attribute with the
given value. |
NodeList |
getElementsByTagName(java.lang.String tagname)
Returns a
NodeList of all the Elements in
document order with a given tag name and are contained in the
document. |
NodeList |
getElementsByTagNameNS(java.lang.String namespaceURI,
java.lang.String localName)
Returns a
NodeList of all the Elements with a
given local name and namespace URI in document order. |
java.lang.Object |
getFeature(java.lang.String feature,
java.lang.String version)
This method returns a specialized object which implements the
specialized APIs of the specified feature and version.
|
Node |
getFirstChild()
The first child of this node.
|
DOMImplementation |
getImplementation()
The
DOMImplementation object that handles this document. |
java.lang.String |
getInputEncoding()
|
Node |
getLastChild()
The last child of this node.
|
int |
getLength()
The number of 16-bit units that are available through
data
and the substringData method below. |
java.lang.String |
getLocalName()
Returns the local part of the qualified name of this node.
|
java.lang.String |
getName()
Returns the name of this attribute.
|
java.lang.String |
getNamespaceURI()
The namespace URI of this node, or
null if it is
unspecified (see ). |
Node |
getNextSibling()
The node immediately following this node.
|
java.lang.String |
getNodeName()
The name of this node, depending on its type; see the table above.
|
short |
getNodeType()
A code representing the type of the underlying object, as defined above.
|
java.lang.String |
getNodeValue()
The value of this node, depending on its type; see the table above.
|
Document |
getOwnerDocument()
The
Document object associated with this node. |
Element |
getOwnerElement()
Get the owner element of an attribute.
|
Node |
getOwnerNode() |
Node |
getParentNode()
The parent of this node.
|
java.lang.String |
getPrefix()
The namespace prefix of this node, or
null if it is
unspecified. |
Node |
getPreviousSibling()
The node immediately preceding this node.
|
TypeInfo |
getSchemaTypeInfo()
The type information associated with this element.
|
boolean |
getSpecified()
True if this attribute was explicitly given a value in
the instance document, false otherwise. |
boolean |
getStrictErrorChecking()
|
java.lang.String |
getStringValue() |
java.lang.String |
getTagName()
The name of the element.
|
java.lang.String |
getTarget()
A PI's "target" states what processor channel the PI's data
should be directed to.
|
java.lang.String |
getTextContent()
This attribute returns the text content of this node and its
descendants.
|
java.lang.Object |
getUserData(java.lang.String key)
Retrieves the object associated to a key on a this node.
|
java.lang.String |
getValue()
On retrieval, the value of the attribute is returned as a string.
|
java.lang.String |
getWholeText()
DOM Level 3
Returns all text of
Text nodes logically-adjacent text
nodes to this node, concatenated in document order. |
java.lang.String |
getXmlEncoding()
An attribute specifying, as part of the XML declaration, the encoding of this document.
|
boolean |
getXmlStandalone()
An attribute specifying, as part of the XML declaration, whether this document is standalone.
|
java.lang.String |
getXmlVersion()
An attribute specifying, as part of the XML declaration, the version number of this document.
|
boolean |
hasAttribute(java.lang.String name)
Method hasAttribute
|
boolean |
hasAttributeNS(java.lang.String namespaceURI,
java.lang.String localName)
Method hasAttributeNS
|
boolean |
hasAttributes()
Introduced in DOM Level 2.
|
boolean |
hasChildNodes()
Returns whether this node has any children.
|
Node |
importNode(Node importedNode,
boolean deep)
Imports a node from another document to this document, without altering
or removing the source node from the original document; this method
creates a new copy of the source node.
|
Node |
insertBefore(Node newChild,
Node refChild)
Inserts the node
newChild before the existing child node
refChild . |
void |
insertData(int offset,
java.lang.String arg)
Insert a string at the specified 16-bit unit offset.
|
boolean |
isDefaultNamespace(java.lang.String namespaceURI)
DOM Level 3:
This method checks if the specified
namespaceURI is the
default namespace or not. |
boolean |
isElementContentWhitespace()
DOM Level 3
Returns whether this text node contains whitespace in element content,
often abusively called "ignorable whitespace".
|
boolean |
isEqualNode(Node arg)
Tests whether two nodes are equal.
|
boolean |
isId()
Returns whether this attribute is known to be of type ID (i.e. to
contain an identifier for its owner element) or not.
|
boolean |
isSameNode(Node other)
Returns whether this node is the same node as the given one.
|
boolean |
isSupported(java.lang.String feature,
java.lang.String version)
Ask whether we support a given DOM feature.
|
java.lang.String |
lookupNamespaceURI(java.lang.String specifiedPrefix)
DOM Level 3:
Look up the namespace URI associated to the given prefix, starting from this node.
|
java.lang.String |
lookupPrefix(java.lang.String namespaceURI)
DOM Level 3:
Look up the prefix associated to the given namespace URI, starting from this node.
|
void |
normalize()
Puts all
Text nodes in the full depth of the sub-tree
underneath this Node , including attribute nodes, into a
"normal" form where only structure (e.g., elements, comments,
processing instructions, CDATA sections, and entity references)
separates Text nodes, i.e., there are neither adjacent
Text nodes nor empty Text nodes. |
void |
normalizeDocument()
DOM Level 3
Normalize document.
|
void |
removeAttribute(java.lang.String name)
Removes an attribute by name.
|
Attr |
removeAttributeNode(Attr oldAttr)
Removes the specified attribute node.
|
void |
removeAttributeNS(java.lang.String namespaceURI,
java.lang.String localName)
Removes an attribute by local name and namespace URI.
|
Node |
removeChild(Node oldChild)
Removes the child node indicated by
oldChild from the list
of children, and returns it. |
Node |
renameNode(Node n,
java.lang.String namespaceURI,
java.lang.String name)
DOM Level 3
Renaming node
|
Node |
replaceChild(Node newChild,
Node oldChild)
Replaces the child node
oldChild with newChild
in the list of children, and returns the oldChild node. |
void |
replaceData(int offset,
int count,
java.lang.String arg)
Replace the characters starting at the specified 16-bit unit offset
with the specified string.
|
Text |
replaceWholeText(java.lang.String content)
DOM Level 3
|
boolean |
sameNodeAs(Node other)
FUTURE DOM: Test node identity, in lieu of Node==Node
|
void |
setActualEncoding(java.lang.String value)
DOM Level 3
An attribute specifying the actual encoding of this document.
|
void |
setAttribute(java.lang.String name,
java.lang.String value)
Adds a new attribute.
|
Attr |
setAttributeNode(Attr newAttr)
Adds a new attribute node.
|
Attr |
setAttributeNodeNS(Attr newAttr)
Adds a new attribute.
|
void |
setAttributeNS(java.lang.String namespaceURI,
java.lang.String qualifiedName,
java.lang.String value)
Adds a new attribute.
|
void |
setData(java.lang.String data)
The character data of the node that implements this interface.
|
void |
setDocumentURI(java.lang.String documentURI)
DOM Level 3
|
void |
setIdAttribute(boolean id)
NON-DOM: set the type of this attribute to be ID type.
|
void |
setIdAttribute(java.lang.String name,
boolean makeId)
DOM Level 3: register the given attribute node as an ID attribute
|
void |
setIdAttributeNode(Attr at,
boolean makeId)
DOM Level 3: register the given attribute node as an ID attribute
|
void |
setIdAttributeNS(java.lang.String namespaceURI,
java.lang.String localName,
boolean makeId)
DOM Level 3: register the given attribute node as an ID attribute
|
void |
setNodeValue(java.lang.String nodeValue)
The value of this node, depending on its type; see the table above.
|
void |
setPrefix(java.lang.String prefix)
The namespace prefix of this node, or
null if it is
unspecified. |
void |
setStrictErrorChecking(boolean strictErrorChecking)
|
void |
setTextContent(java.lang.String textContent)
This attribute returns the text content of this node and its
descendants.
|
java.lang.Object |
setUserData(java.lang.String key,
java.lang.Object data,
UserDataHandler handler)
Associate an object to a key on this node.
|
void |
setValue(java.lang.String value)
On retrieval, the value of the attribute is returned as a string.
|
void |
setXmlEncoding(java.lang.String xmlEncoding) |
void |
setXmlStandalone(boolean xmlStandalone)
An attribute specifying, as part of the XML declaration, whether this document is standalone.
|
void |
setXmlVersion(java.lang.String xmlVersion)
An attribute specifying, as part of the XML declaration, the version number of this document.
|
Text |
splitText(int offset)
Breaks this node into two nodes at the specified
offset ,
keeping both in the tree as siblings. |
java.lang.String |
substringData(int offset,
int count)
Extracts a range of data from the node.
|
boolean |
supports(java.lang.String feature,
java.lang.String version)
Ask whether we support a given DOM feature.
|
public DTM dtm
public DTMNodeProxy(DTM dtm, int node)
dtm
- The DTM Reference, must be non-null.node
- The DTM node handle.public final DTM getDTM()
public final int getDTMNodeNumber()
public final boolean equals(Node node)
node
- A DTM node proxy reference.public final boolean equals(java.lang.Object node)
equals
in class java.lang.Object
node
- A DTM node proxy reference.public final boolean sameNodeAs(Node other)
other
- public final java.lang.String getNodeName()
Node
getNodeName
in interface Node
Node
public final java.lang.String getTarget()
In XML, a PI's "target" is the first (whitespace-delimited) token following the "" token that begins the PI.
In HTML, target is always null.
Note that getNodeName is aliased to getTarget.
getTarget
in interface ProcessingInstruction
public final java.lang.String getLocalName()
Node
ELEMENT_NODE
and
ATTRIBUTE_NODE
and nodes created with a DOM Level 1
method, such as Document.createElement()
, this is always
null
.getLocalName
in interface Node
as of DOM Level 2
public final java.lang.String getPrefix()
Node
null
if it is
unspecified. When it is defined to be null
, setting it
has no effect, including if the node is read-only.
nodeName
attribute, which holds the qualified name, as
well as the tagName
and name
attributes of
the Element
and Attr
interfaces, when
applicable.
null
makes it unspecified,
setting it to an empty string is implementation dependent.
namespaceURI
and localName
do not change.
ELEMENT_NODE
and
ATTRIBUTE_NODE
and nodes created with a DOM Level 1
method, such as createElement
from the
Document
interface, this is always null
.getPrefix
in interface Node
as of DOM Level 2
public final void setPrefix(java.lang.String prefix) throws DOMException
Node
null
if it is
unspecified. When it is defined to be null
, setting it
has no effect, including if the node is read-only.
nodeName
attribute, which holds the qualified name, as
well as the tagName
and name
attributes of
the Element
and Attr
interfaces, when
applicable.
null
makes it unspecified,
setting it to an empty string is implementation dependent.
namespaceURI
and localName
do not change.
ELEMENT_NODE
and
ATTRIBUTE_NODE
and nodes created with a DOM Level 1
method, such as createElement
from the
Document
interface, this is always null
.setPrefix
in interface Node
prefix
- DOMException
as of DOM Level 2 -- DTMNodeProxy is read-only
public final java.lang.String getNamespaceURI()
Node
null
if it is
unspecified (see ).
ELEMENT_NODE
and
ATTRIBUTE_NODE
and nodes created with a DOM Level 1
method, such as Document.createElement()
, this is always
null
.
Note: Per the Namespaces in XML Specification [XML Namespaces] an attribute does not inherit its namespace from the element it is attached to. If an attribute is not explicitly given a namespace, it simply has no namespace.
getNamespaceURI
in interface Node
as of DOM Level 2
public final boolean supports(java.lang.String feature, java.lang.String version)
feature
- version
- public final boolean isSupported(java.lang.String feature, java.lang.String version)
isSupported
in interface Node
feature
- version
- as of DOM Level 2
public final java.lang.String getNodeValue() throws DOMException
Node
null
, setting it has no effect,
including if the node is read-only.getNodeValue
in interface Node
DOMException
Node
public final java.lang.String getStringValue() throws DOMException
DOMException
public final void setNodeValue(java.lang.String nodeValue) throws DOMException
Node
null
, setting it has no effect,
including if the node is read-only.setNodeValue
in interface Node
nodeValue
- DOMException
-- DTMNodeProxy is read-only
public final short getNodeType()
Node
getNodeType
in interface Node
Node
public final Node getParentNode()
Node
Attr
,
Document
, DocumentFragment
,
Entity
, and Notation
may have a parent.
However, if a node has just been created and not yet added to the
tree, or if it has been removed from the tree, this is
null
.getParentNode
in interface Node
Node
public final NodeList getChildNodes()
Node
NodeList
that contains all children of this node. If
there are no children, this is a NodeList
containing no
nodes.getChildNodes
in interface Node
Node
public final Node getFirstChild()
Node
null
.getFirstChild
in interface Node
Node
public final Node getLastChild()
Node
null
.getLastChild
in interface Node
Node
public final Node getPreviousSibling()
Node
null
.getPreviousSibling
in interface Node
Node
public final Node getNextSibling()
Node
null
.getNextSibling
in interface Node
Node
public final NamedNodeMap getAttributes()
Node
NamedNodeMap
containing the attributes of this node (if
it is an Element
) or null
otherwise.getAttributes
in interface Node
Node
public boolean hasAttribute(java.lang.String name)
hasAttribute
in interface Element
name
- true
if an attribute with the given name is
specified on this element or has a default value, false
otherwise.public boolean hasAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
hasAttributeNS
in interface Element
namespaceURI
- localName
- true
if an attribute with the given local name
and namespace URI is specified or has a default value on this
element, false
otherwise.public final Document getOwnerDocument()
Node
Document
object associated with this node. This is
also the Document
object used to create new nodes. When
this node is a Document
or a DocumentType
which is not used with any Document
yet, this is
null
.getOwnerDocument
in interface Node
Node
public final Node insertBefore(Node newChild, Node refChild) throws DOMException
Node
newChild
before the existing child node
refChild
. If refChild
is null
,
insert newChild
at the end of the list of children.
newChild
is a DocumentFragment
object,
all of its children are inserted, in the same order, before
refChild
. If the newChild
is already in the
tree, it is first removed.
Note: Inserting a node before itself is implementation dependent.
insertBefore
in interface Node
newChild
- refChild
- DOMException
-- DTMNodeProxy is read-only
public final Node replaceChild(Node newChild, Node oldChild) throws DOMException
Node
oldChild
with newChild
in the list of children, and returns the oldChild
node.
newChild
is a DocumentFragment
object,
oldChild
is replaced by all of the
DocumentFragment
children, which are inserted in the
same order. If the newChild
is already in the tree, it
is first removed.
Note: Replacing a node with itself is implementation dependent.
replaceChild
in interface Node
newChild
- oldChild
- DOMException
-- DTMNodeProxy is read-only
public final Node removeChild(Node oldChild) throws DOMException
Node
oldChild
from the list
of children, and returns it.removeChild
in interface Node
oldChild
- DOMException
-- DTMNodeProxy is read-only
public final Node appendChild(Node newChild) throws DOMException
Node
newChild
to the end of the list of children
of this node. If the newChild
is already in the tree, it
is first removed.appendChild
in interface Node
newChild
- DOMException
-- DTMNodeProxy is read-only
public final boolean hasChildNodes()
Node
hasChildNodes
in interface Node
true
if this node has any children,
false
otherwise.Node
public final Node cloneNode(boolean deep)
Node
parentNode
is null
) and no user data. User
data associated to the imported node is not carried over. However, if
any UserDataHandlers
has been specified along with the
associated data these handlers will be called with the appropriate
parameters before this method returns.
Element
copies all attributes and their
values, including those generated by the XML processor to represent
defaulted attributes, but this method does not copy any children it
contains unless it is a deep clone. This includes text contained in
an the Element
since the text is contained in a child
Text
node. Cloning an Attr
directly, as
opposed to be cloned as part of an Element
cloning
operation, returns a specified attribute (specified
is
true
). Cloning an Attr
always clones its
children, since they represent its value, no matter whether this is a
deep clone or not. Cloning an EntityReference
automatically constructs its subtree if a corresponding
Entity
is available, no matter whether this is a deep
clone or not. Cloning any other type of node simply returns a copy of
this node.
EntityReference
clone are readonly
. In addition, clones of unspecified Attr
nodes are
specified. And, cloning Document
,
DocumentType
, Entity
, and
Notation
nodes is implementation dependent.cloneNode
in interface Node
deep
- -- DTMNodeProxy is read-only
public final DocumentType getDoctype()
Document
DocumentType
)
associated with this document. For XML documents without a document
type declaration this returns null
. For HTML documents,
a DocumentType
object may be returned, independently of
the presence or absence of document type declaration in the HTML
document.
DocumentType
node,
child node of this Document
. This node can be set at
document creation time and later changed through the use of child
nodes manipulation methods, such as Node.insertBefore
,
or Node.replaceChild
. Note, however, that while some
implementations may instantiate different types of
Document
objects supporting additional features than the
"Core", such as "HTML" [DOM Level 2 HTML]
, based on the DocumentType
specified at creation time,
changing it afterwards is very unlikely to result in a change of the
features supported.getDoctype
in interface Document
Document
public final DOMImplementation getImplementation()
Document
DOMImplementation
object that handles this document. A
DOM application may use objects from multiple implementations.getImplementation
in interface Document
Document
public final Element getDocumentElement()
getDocumentElement
in interface Document
Document
public final Element createElement(java.lang.String tagName) throws DOMException
Document
Element
interface, so attributes
can be specified directly on the returned object.
Attr
nodes representing them are automatically created
and attached to the element.
createElementNS
method.createElement
in interface Document
tagName
- Element
object with the
nodeName
attribute set to tagName
, and
localName
, prefix
, and
namespaceURI
set to null
.DOMException
Document
public final DocumentFragment createDocumentFragment()
Document
DocumentFragment
object.createDocumentFragment
in interface Document
DocumentFragment
.Document
public final Text createTextNode(java.lang.String data)
Document
Text
node given the specified string.createTextNode
in interface Document
data
- Text
object.Document
public final Comment createComment(java.lang.String data)
Document
Comment
node given the specified string.createComment
in interface Document
data
- Comment
object.Document
public final CDATASection createCDATASection(java.lang.String data) throws DOMException
Document
CDATASection
node whose value is the specified
string.createCDATASection
in interface Document
data
- CDATASection
object.DOMException
Document
public final ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data) throws DOMException
Document
ProcessingInstruction
node given the specified
name and data strings.createProcessingInstruction
in interface Document
target
- data
- ProcessingInstruction
object.DOMException
Document
public final Attr createAttribute(java.lang.String name) throws DOMException
Document
Attr
of the given name. Note that the
Attr
instance can then be set on an Element
using the setAttributeNode
method.
createAttributeNS
method.createAttribute
in interface Document
name
- Attr
object with the nodeName
attribute set to name
, and localName
,
prefix
, and namespaceURI
set to
null
. The value of the attribute is the empty string.DOMException
Document
public final EntityReference createEntityReference(java.lang.String name) throws DOMException
Document
EntityReference
object. In addition, if the
referenced entity is known, the child list of the
EntityReference
node is made the same as that of the
corresponding Entity
node.
Note: If any descendant of the Entity
node has
an unbound namespace prefix, the corresponding descendant of the
created EntityReference
node is also unbound; (its
namespaceURI
is null
). The DOM Level 2 and
3 do not support any mechanism to resolve namespace prefixes in this
case.
createEntityReference
in interface Document
name
- EntityReference
object.DOMException
Document
public final NodeList getElementsByTagName(java.lang.String tagname)
Document
NodeList
of all the Elements
in
document order with a given tag name and are contained in the
document.getElementsByTagName
in interface Document
getElementsByTagName
in interface Element
tagname
- NodeList
object containing all the matched
Elements
.Document
public final Node importNode(Node importedNode, boolean deep) throws DOMException
Document
parentNode
is null
).
nodeName
and nodeType
, plus the
attributes related to namespaces (prefix
,
localName
, and namespaceURI
). As in the
cloneNode
operation, the source node is not altered.
User data associated to the imported node is not carried over.
However, if any UserDataHandlers
has been specified
along with the associated data these handlers will be called with the
appropriate parameters before this method returns.
nodeType
, attempting to mirror the behavior expected if
a fragment of XML or HTML source was copied from one document to
another, recognizing that the two documents may have different DTDs
in the XML case. The following list describes the specifics for each
type of node.
ownerElement
attribute
is set to null
and the specified
flag is
set to true
on the generated Attr
. The
descendants of the source Attr
are recursively imported
and the resulting nodes reassembled to form the corresponding subtree.
Note that the deep
parameter has no effect on
Attr
nodes; they always carry their children with them
when imported.deep
option
was set to true
, the descendants of the source
DocumentFragment
are recursively imported and the
resulting nodes reassembled under the imported
DocumentFragment
to form the corresponding subtree.
Otherwise, this simply generates an empty
DocumentFragment
.Document
nodes cannot be imported.DocumentType
nodes cannot be imported.Attr
nodes are attached to the generated
Element
. Default attributes are not copied, though if the document being imported into defines default
attributes for this element name, those are assigned. If the
importNode
deep
parameter was set to
true
, the descendants of the source element are
recursively imported and the resulting nodes reassembled to form the
corresponding subtree.Entity
nodes can be
imported, however in the current release of the DOM the
DocumentType
is readonly. Ability to add these imported
nodes to a DocumentType
will be considered for addition
to a future release of the DOM.On import, the publicId
,
systemId
, and notationName
attributes are
copied. If a deep
import is requested, the descendants
of the the source Entity
are recursively imported and
the resulting nodes reassembled to form the corresponding subtree.EntityReference
itself is
copied, even if a deep
import is requested, since the
source and destination documents might have defined the entity
differently. If the document being imported into provides a
definition for this entity name, its value is assigned.Notation
nodes can be imported, however in the current
release of the DOM the DocumentType
is readonly. Ability
to add these imported nodes to a DocumentType
will be
considered for addition to a future release of the DOM.On import, the
publicId
and systemId
attributes are copied.
Note that the deep
parameter has no effect on this type
of nodes since they cannot have any children.target
and data
values from those of the
source node.Note that the deep
parameter has no effect
on this type of nodes since they cannot have any children.CharacterData
copy their data
and
length
attributes from those of the source node.Note
that the deep
parameter has no effect on these types of
nodes since they cannot have any children.importNode
in interface Document
importedNode
- deep
- Document
.DOMException
as of DOM Level 2 -- DTMNodeProxy is read-only
public final Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName) throws DOMException
Document
null
as the
namespaceURI parameter for methods if they wish to have no namespace.createElementNS
in interface Document
namespaceURI
- qualifiedName
- Element
object with the following
attributes:
Attribute | Value |
---|---|
Node.nodeName |
qualifiedName |
Node.namespaceURI |
namespaceURI |
Node.prefix |
prefix, extracted
from qualifiedName , or null if there is
no prefix |
Node.localName |
local name, extracted from
qualifiedName |
Element.tagName |
qualifiedName |
DOMException
as of DOM Level 2
public final Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName) throws DOMException
Document
null
as the
namespaceURI
parameter for methods if they wish to have
no namespace.createAttributeNS
in interface Document
namespaceURI
- qualifiedName
- Attr
object with the following attributes:
Attribute | Value |
---|---|
Node.nodeName |
qualifiedName |
Node.namespaceURI |
namespaceURI |
Node.prefix |
prefix, extracted from
qualifiedName , or null if there is no
prefix |
Node.localName |
local name, extracted from
qualifiedName |
Attr.name |
qualifiedName |
Node.nodeValue |
the empty string |
DOMException
as of DOM Level 2
public final NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
Document
NodeList
of all the Elements
with a
given local name and namespace URI in document order.getElementsByTagNameNS
in interface Document
getElementsByTagNameNS
in interface Element
namespaceURI
- localName
- NodeList
object containing all the matched
Elements
.as of DOM Level 2
public final Element getElementById(java.lang.String elementId)
Document
Element
that has an ID attribute with the
given value. If no such element exists, this returns null
. If more than one element has an ID attribute with that value, what
is returned is undefined.
Attr.isId
to determine if an attribute is of type ID.
Note: Attributes with the name "ID" or "id" are not of type ID unless so defined.
getElementById
in interface Document
elementId
- null
if there is none.as of DOM Level 2
public final Text splitText(int offset) throws DOMException
Text
offset
,
keeping both in the tree as siblings. After being split, this node
will contain all the content up to the offset
point. A
new node of the same type, which contains all the content at and
after the offset
point, is returned. If the original
node had a parent node, the new node is inserted as the next sibling
of the original node. When the offset
is equal to the
length of this node, the new node has no data.splitText
in interface Text
offset
- DOMException
Text
public final java.lang.String getData() throws DOMException
CharacterData
CharacterData
node. However,
implementation limits may mean that the entirety of a node's data may
not fit into a single DOMString
. In such cases, the user
may call substringData
to retrieve the data in
appropriately sized pieces.getData
in interface CharacterData
getData
in interface ProcessingInstruction
DOMException
CharacterData
public final void setData(java.lang.String data) throws DOMException
CharacterData
CharacterData
node. However,
implementation limits may mean that the entirety of a node's data may
not fit into a single DOMString
. In such cases, the user
may call substringData
to retrieve the data in
appropriately sized pieces.setData
in interface CharacterData
setData
in interface ProcessingInstruction
data
- DOMException
CharacterData
public final int getLength()
CharacterData
data
and the substringData
method below. This may have the
value zero, i.e., CharacterData
nodes may be empty.getLength
in interface CharacterData
CharacterData
public final java.lang.String substringData(int offset, int count) throws DOMException
CharacterData
substringData
in interface CharacterData
offset
- count
- offset
and
count
exceeds the length
, then all 16-bit
units to the end of the data are returned.DOMException
CharacterData
public final void appendData(java.lang.String arg) throws DOMException
CharacterData
data
provides access to the concatenation of
data
and the DOMString
specified.appendData
in interface CharacterData
arg
- DOMException
CharacterData
public final void insertData(int offset, java.lang.String arg) throws DOMException
CharacterData
insertData
in interface CharacterData
offset
- arg
- DOMException
CharacterData
public final void deleteData(int offset, int count) throws DOMException
CharacterData
data
and length
reflect the change.deleteData
in interface CharacterData
offset
- count
- DOMException
CharacterData
public final void replaceData(int offset, int count, java.lang.String arg) throws DOMException
CharacterData
replaceData
in interface CharacterData
offset
- count
- arg
- DOMException
CharacterData
public final java.lang.String getTagName()
Element
Node.localName
is different
from null
, this attribute is a qualified name. For
example, in:
<elementExample id="demo"> ... </elementExample> ,
tagName
has the value
"elementExample"
. Note that this is case-preserving in
XML, as are all of the operations of the DOM. The HTML DOM returns
the tagName
of an HTML element in the canonical
uppercase form, regardless of the case in the source HTML document.getTagName
in interface Element
Element
public final java.lang.String getAttribute(java.lang.String name)
Element
getAttribute
in interface Element
name
- Attr
value as a string, or the empty string
if that attribute does not have a specified or default value.Element
public final void setAttribute(java.lang.String name, java.lang.String value) throws DOMException
Element
Attr
node plus any
Text
and EntityReference
nodes, build the
appropriate subtree, and use setAttributeNode
to assign
it as the value of an attribute.
setAttributeNS
method.setAttribute
in interface Element
name
- value
- DOMException
Element
public final void removeAttribute(java.lang.String name) throws DOMException
Element
Document.normalizeDocument()
to guarantee this
information is up-to-date.
removeAttributeNS
method.removeAttribute
in interface Element
name
- DOMException
Element
public final Attr getAttributeNode(java.lang.String name)
Element
getAttributeNodeNS
method.getAttributeNode
in interface Element
name
- Attr
node with the specified name (
nodeName
) or null
if there is no such
attribute.Element
public final Attr setAttributeNode(Attr newAttr) throws DOMException
Element
nodeName
) is already present in the element, it is
replaced by the new one. Replacing an attribute node by itself has no
effect.
setAttributeNodeNS
method.setAttributeNode
in interface Element
newAttr
- newAttr
attribute replaces an existing
attribute, the replaced Attr
node is returned,
otherwise null
is returned.DOMException
Element
public final Attr removeAttributeNode(Attr oldAttr) throws DOMException
Element
Attr
node is defined in the DTD, a new node
immediately appears with the default value as well as the
corresponding namespace URI, local name, and prefix when applicable.
The implementation may handle default values from other schemas
similarly but applications should use
Document.normalizeDocument()
to guarantee this
information is up-to-date.removeAttributeNode
in interface Element
oldAttr
- Attr
node that was removed.DOMException
Element
public boolean hasAttributes()
hasAttributes
in interface Node
true
if this node has any attributes,
false
otherwise.public final void normalize()
Node
Text
nodes in the full depth of the sub-tree
underneath this Node
, including attribute nodes, into a
"normal" form where only structure (e.g., elements, comments,
processing instructions, CDATA sections, and entity references)
separates Text
nodes, i.e., there are neither adjacent
Text
nodes nor empty Text
nodes. This can
be used to ensure that the DOM view of a document is the same as if
it were saved and re-loaded, and is useful when operations (such as
XPointer [XPointer]
lookups) that depend on a particular document tree structure are to
be used. If the parameter "normalize-characters" of the
DOMConfiguration
object attached to the
Node.ownerDocument
is true
, this method
will also fully normalize the characters of the Text
nodes.
Note: In cases where the document contains
CDATASections
, the normalize operation alone may not be
sufficient, since XPointers do not differentiate between
Text
nodes and CDATASection
nodes.
public final java.lang.String getAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
Element
null
as the
namespaceURI
parameter for methods if they wish to have
no namespace.getAttributeNS
in interface Element
namespaceURI
- localName
- Attr
value as a string, or the empty string
if that attribute does not have a specified or default value.Element
public final void setAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String value) throws DOMException
Element
qualifiedName
, and
its value is changed to be the value
parameter. This
value is a simple string; it is not parsed as it is being set. So any
markup (such as syntax to be recognized as an entity reference) is
treated as literal text, and needs to be appropriately escaped by the
implementation when it is written out. In order to assign an
attribute value that contains entity references, the user must create
an Attr
node plus any Text
and
EntityReference
nodes, build the appropriate subtree,
and use setAttributeNodeNS
or
setAttributeNode
to assign it as the value of an
attribute.
null
as the
namespaceURI
parameter for methods if they wish to have
no namespace.setAttributeNS
in interface Element
namespaceURI
- qualifiedName
- value
- DOMException
Element
public final void removeAttributeNS(java.lang.String namespaceURI, java.lang.String localName) throws DOMException
Element
Document.normalizeDocument()
to guarantee this
information is up-to-date.
null
as the
namespaceURI
parameter for methods if they wish to have
no namespace.removeAttributeNS
in interface Element
namespaceURI
- localName
- DOMException
Element
public final Attr getAttributeNodeNS(java.lang.String namespaceURI, java.lang.String localName)
Element
Attr
node by local name and namespace URI.
null
as the
namespaceURI
parameter for methods if they wish to have
no namespace.getAttributeNodeNS
in interface Element
namespaceURI
- localName
- Attr
node with the specified attribute local
name and namespace URI or null
if there is no such
attribute.Element
public final Attr setAttributeNodeNS(Attr newAttr) throws DOMException
Element
null
as the
namespaceURI
parameter for methods if they wish to have
no namespace.setAttributeNodeNS
in interface Element
newAttr
- newAttr
attribute replaces an existing
attribute with the same local name and namespace URI, the replaced
Attr
node is returned, otherwise null
is
returned.DOMException
Element
public final java.lang.String getName()
Attr
Node.localName
is
different from null
, this attribute is a qualified name.public final boolean getSpecified()
Attr
True
if this attribute was explicitly given a value in
the instance document, false
otherwise. If the
application changed the value of this attribute node (even if it ends
up having the same value as the default value) then it is set to
true
. The implementation may handle attributes with
default values from other schemas similarly but applications should
use Document.normalizeDocument()
to guarantee this
information is up-to-date.getSpecified
in interface Attr
Attr
public final java.lang.String getValue()
Attr
getAttribute
on the
Element
interface.
Text
node with the unparsed
contents of the string, i.e. any characters that an XML processor
would recognize as markup are instead treated as literal text. See
also the method Element.setAttribute()
.
public final void setValue(java.lang.String value)
Attr
getAttribute
on the
Element
interface.
Text
node with the unparsed
contents of the string, i.e. any characters that an XML processor
would recognize as markup are instead treated as literal text. See
also the method Element.setAttribute()
.
public final Element getOwnerElement()
getOwnerElement
in interface Attr
as of DOM Level 2
public Node adoptNode(Node source) throws DOMException
adoptNode
in interface Document
source
- The node to move into this document.null
if this operation
fails, such as when the source node comes from a different
implementation.DOMException
public java.lang.String getInputEncoding()
Based on the Document Object Model (DOM) Level 3 Core Specification of 07 April 2004..
An attribute specifying, as part of the XML declaration, the encoding
of this document. This is null
when unspecified.
getInputEncoding
in interface Document
public boolean getStrictErrorChecking()
Based on the Document Object Model (DOM) Level 3 Core Specification of 07 April 2004..
An attribute specifying whether errors checking is enforced or not.
When set to false
, the implementation is free to not
test every possible error case normally defined on DOM operations,
and not raise any DOMException
. In case of error, the
behavior is undefined. This attribute is true
by
defaults.
getStrictErrorChecking
in interface Document
public void setStrictErrorChecking(boolean strictErrorChecking)
Based on the Document Object Model (DOM) Level 3 Core Specification of 07 April 2004..
An attribute specifying whether errors checking is enforced or not.
When set to false
, the implementation is free to not
test every possible error case normally defined on DOM operations,
and not raise any DOMException
. In case of error, the
behavior is undefined. This attribute is true
by
defaults.
setStrictErrorChecking
in interface Document
public java.lang.Object setUserData(java.lang.String key, java.lang.Object data, UserDataHandler handler)
Node
getUserData
with the
same key.setUserData
in interface Node
key
- The key to associate the object to.data
- The object to associate to the given key, or
null
to remove any existing association to that key.handler
- The handler to associate to that key, or
null
.DOMUserData
previously associated to
the given key on this node, or null
if there was none.public java.lang.Object getUserData(java.lang.String key)
setUserData
with the same key.getUserData
in interface Node
key
- The key the object is associated to.DOMObject
associated to the given key
on this node, or null
if there was none.public java.lang.Object getFeature(java.lang.String feature, java.lang.String version)
getFeature
in interface Node
feature
- The name of the feature requested (case-insensitive).version
- This is the version number of the feature to test. If
the version is null
or the empty string, supporting
any version of the feature will cause the method to return an
object that supports at least one version of the feature.null
if
there is no object which implements interfaces associated with that
feature. If the DOMObject
returned by this method
implements the Node
interface, it must delegate to the
primary core Node
and not return results inconsistent
with the primary core Node
such as attributes,
childNodes, etc.public boolean isEqualNode(Node arg)
Node.isSameNode
. All nodes that are the same
will also be equal, though the reverse may not be true.
nodeName
, localName
,
namespaceURI
, prefix
, nodeValue
, baseURI
. This is: they are both null
, or
they have the same length and are character for character identical.
The attributes
NamedNodeMaps
are equal.
This is: they are both null
, or they have the same
length and for each node that exists in one map there is a node that
exists in the other map and is equal, although not necessarily at the
same index.The childNodes
NodeLists
are
equal. This is: they are both null
, or they have the
same length and contain equal nodes at the same index. This is true
for Attr
nodes as for any other type of node. Note that
normalization can affect equality; to avoid this, nodes should be
normalized before being compared.
DocumentType
nodes to be equal, the following
conditions must also be satisfied: The following string attributes
are equal: publicId
, systemId
,
internalSubset
.The entities
NamedNodeMaps
are equal.The notations
NamedNodeMaps
are equal.
ownerDocument
attribute, the specified
attribute for Attr
nodes, the
isWhitespaceInElementContent
attribute for
Text
nodes, as well as any user data or event listeners
registered on the nodes.isEqualNode
in interface Node
arg
- The node to compare equality with.deep
- If true
, recursively compare the subtrees; if
false
, compare only the nodes themselves (and its
attributes, if it is an Element
).true
otherwise false
.public java.lang.String lookupNamespaceURI(java.lang.String specifiedPrefix)
lookupNamespaceURI
in interface Node
namespaceURI
- public boolean isDefaultNamespace(java.lang.String namespaceURI)
namespaceURI
is the
default namespace or not.isDefaultNamespace
in interface Node
namespaceURI
- The namespace URI to look for.true
if the specified namespaceURI
is the default namespace, false
otherwise.public java.lang.String lookupPrefix(java.lang.String namespaceURI)
lookupPrefix
in interface Node
namespaceURI
- public boolean isSameNode(Node other)
Node
references returned by the implementation reference
the same object. When two Node
references are references
to the same object, even if through a proxy, the references may be
used completely interchangably, such that all attributes have the
same values and calling the same DOM method on either reference
always has exactly the same effect.isSameNode
in interface Node
other
- The node to test against.true
if the nodes are the same,
false
otherwise.public void setTextContent(java.lang.String textContent) throws DOMException
Text
node containing the string
this attribute is set to. On getting, no serialization is performed,
the returned string does not contain any markup. No whitespace
normalization is performed, the returned string does not contain the
element content whitespaces . Similarly, on setting, no parsing is
performed either, the input string is taken as pure textual content.
Node type | Content |
---|---|
ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODE | concatenation of the textContent
attribute value of every child node, excluding COMMENT_NODE and
PROCESSING_INSTRUCTION_NODE nodes |
ATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE |
nodeValue |
DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE | null |
setTextContent
in interface Node
DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.DOMException
- DOMSTRING_SIZE_ERR: Raised when it would return more characters than
fit in a DOMString
variable on the implementation
platform.public java.lang.String getTextContent() throws DOMException
Text
node containing the string
this attribute is set to. On getting, no serialization is performed,
the returned string does not contain any markup. No whitespace
normalization is performed, the returned string does not contain the
element content whitespaces . Similarly, on setting, no parsing is
performed either, the input string is taken as pure textual content.
Node type | Content |
---|---|
ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODE | concatenation of the textContent
attribute value of every child node, excluding COMMENT_NODE and
PROCESSING_INSTRUCTION_NODE nodes |
ATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE |
nodeValue |
DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE | null |
getTextContent
in interface Node
DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.DOMException
- DOMSTRING_SIZE_ERR: Raised when it would return more characters than
fit in a DOMString
variable on the implementation
platform.public short compareDocumentPosition(Node other) throws DOMException
compareDocumentPosition
in interface Node
other
- The node to compare against this node.DOMException
- NOT_SUPPORTED_ERR: when the compared nodes are from different DOM
implementations that do not coordinate to return consistent
implementation-specific results.public java.lang.String getBaseURI()
null
if undefined.
This value is computed according to . However, when the
Document
supports the feature "HTML" , the base URI is
computed using first the value of the href attribute of the HTML BASE
element if any, and the value of the documentURI
attribute from the Document
interface otherwise.
Element
, a Document
or a a ProcessingInstruction
, this attribute represents
the properties [base URI] defined in . When the node is a
Notation
, an Entity
, or an
EntityReference
, this attribute represents the
properties [declaration base URI] in the . How will this be affected
by resolution of relative namespace URIs issue?It's not.Should this
only be on Document, Element, ProcessingInstruction, Entity, and
Notation nodes, according to the infoset? If not, what is it equal to
on other nodes? Null? An empty string? I think it should be the
parent's.No.Should this be read-only and computed or and actual
read-write attribute?Read-only and computed (F2F 19 Jun 2000 and
teleconference 30 May 2001).If the base HTML element is not yet
attached to a document, does the insert change the Document.baseURI?
Yes. (F2F 26 Sep 2001)getBaseURI
in interface Node
public Node renameNode(Node n, java.lang.String namespaceURI, java.lang.String name) throws DOMException
renameNode
in interface Document
n
- The node to rename.namespaceURI
- The new namespace URI.name
- The new qualified name.DOMException
- NOT_SUPPORTED_ERR: Raised when the type of the specified node is
neither ELEMENT_NODE
nor ATTRIBUTE_NODE
,
or if the implementation does not support the renaming of the
document element.
Document.xmlVersion
attribute.
qualifiedName
is a
malformed qualified name, if the qualifiedName
has a
prefix and the namespaceURI
is null
, or
if the qualifiedName
has a prefix that is "xml" and
the namespaceURI
is different from "
http://www.w3.org/XML/1998/namespace" [XML Namespaces]
. Also raised, when the node being renamed is an attribute, if the
qualifiedName
, or its prefix, is "xmlns" and the
namespaceURI
is different from "http://www.w3.org/2000/xmlns/".public void normalizeDocument()
normalizeDocument
in interface Document
public DOMConfiguration getDomConfig()
Document.normalizeDocument
is
invoked.getDomConfig
in interface Document
public void setDocumentURI(java.lang.String documentURI)
setDocumentURI
in interface Document
public java.lang.String getDocumentURI()
null
if undefined.
Document
supports the feature
"HTML" , the href attribute of the HTML BASE element takes precedence
over this attribute.getDocumentURI
in interface Document
public java.lang.String getActualEncoding()
null
otherwise.
public void setActualEncoding(java.lang.String value)
null
otherwise.
public Text replaceWholeText(java.lang.String content) throws DOMException
replaceWholeText
in interface Text
content
- The content of the replacing Text
node.Text
node created with the specified content.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if one of the Text
nodes being replaced is readonly.public java.lang.String getWholeText()
Text
nodes logically-adjacent text
nodes to this node, concatenated in document order.getWholeText
in interface Text
public boolean isElementContentWhitespace()
isElementContentWhitespace
in interface Text
public void setIdAttribute(boolean id)
id
- public void setIdAttribute(java.lang.String name, boolean makeId)
setIdAttribute
in interface Element
name
- The name of the attribute.makeId
- Whether the attribute is a of type ID.public void setIdAttributeNode(Attr at, boolean makeId)
setIdAttributeNode
in interface Element
at
- The attribute node.makeId
- Whether the attribute is a of type ID.public void setIdAttributeNS(java.lang.String namespaceURI, java.lang.String localName, boolean makeId)
setIdAttributeNS
in interface Element
namespaceURI
- The namespace URI of the attribute.localName
- The local name of the attribute.makeId
- Whether the attribute is a of type ID.public TypeInfo getSchemaTypeInfo()
Element
getSchemaTypeInfo
in interface Attr
getSchemaTypeInfo
in interface Element
public boolean isId()
Attr
ownerElement
of this attribute
can be retrieved using the method Document.getElementById
. The implementation could use several ways to determine if an
attribute node is known to contain an identifier:
Document.normalizeDocument()
, the post-schema-validation
infoset contributions (PSVI contributions) values are used to
determine if this attribute is a schema-determined ID attribute using
the
schema-determined ID definition in [XPointer]
.
Document.normalizeDocument()
, the infoset [type definition] value is used to determine if this attribute is a DTD-determined ID
attribute using the
DTD-determined ID definition in [XPointer]
.
Element.setIdAttribute()
,
Element.setIdAttributeNS()
, or
Element.setIdAttributeNode()
, i.e. it is an
user-determined ID attribute;
Note: XPointer framework (see section 3.2 in [XPointer] ) consider the DOM user-determined ID attribute as being part of the XPointer externally-determined ID definition.
Document.normalizeDocument()
, all user-determined ID
attributes are reset and all attribute nodes ID information are then
reevaluated in accordance to the schema used. As a consequence, if
the Attr.schemaTypeInfo
attribute contains an ID type,
isId
will always return true.public java.lang.String getXmlEncoding()
Document
null
when
unspecified or when it is not known, such as when the
Document
was created in memory.getXmlEncoding
in interface Document
public void setXmlEncoding(java.lang.String xmlEncoding)
public boolean getXmlStandalone()
Document
false
when
unspecified.
Note: No verification is done on the value when setting
this attribute. Applications should use
Document.normalizeDocument()
with the "validate"
parameter to verify if the value matches the validity
constraint for standalone document declaration as defined in [XML 1.0].
getXmlStandalone
in interface Document
public void setXmlStandalone(boolean xmlStandalone) throws DOMException
Document
false
when
unspecified.
Note: No verification is done on the value when setting
this attribute. Applications should use
Document.normalizeDocument()
with the "validate"
parameter to verify if the value matches the validity
constraint for standalone document declaration as defined in [XML 1.0].
setXmlStandalone
in interface Document
DOMException
- NOT_SUPPORTED_ERR: Raised if this document does not support the
"XML" feature.public java.lang.String getXmlVersion()
Document
"1.0"
. If this document does not support the "XML"
feature, the value is always null
. Changing this
attribute will affect methods that check for invalid characters in
XML names. Application should invoke
Document.normalizeDocument()
in order to check for
invalid characters in the Node
s that are already part of
this Document
.
DOMImplementation.hasFeature(feature, version)
method
with parameter values "XMLVersion" and "1.0" (respectively) to
determine if an implementation supports [XML 1.0]. DOM
applications may use the same method with parameter values
"XMLVersion" and "1.1" (respectively) to determine if an
implementation supports [XML 1.1]. In both
cases, in order to support XML, an implementation must also support
the "XML" feature defined in this specification. Document
objects supporting a version of the "XMLVersion" feature must not
raise a NOT_SUPPORTED_ERR
exception for the same version
number when using Document.xmlVersion
.getXmlVersion
in interface Document
public void setXmlVersion(java.lang.String xmlVersion) throws DOMException
Document
"1.0"
. If this document does not support the "XML"
feature, the value is always null
. Changing this
attribute will affect methods that check for invalid characters in
XML names. Application should invoke
Document.normalizeDocument()
in order to check for
invalid characters in the Node
s that are already part of
this Document
.
DOMImplementation.hasFeature(feature, version)
method
with parameter values "XMLVersion" and "1.0" (respectively) to
determine if an implementation supports [XML 1.0]. DOM
applications may use the same method with parameter values
"XMLVersion" and "1.1" (respectively) to determine if an
implementation supports [XML 1.1]. In both
cases, in order to support XML, an implementation must also support
the "XML" feature defined in this specification. Document
objects supporting a version of the "XMLVersion" feature must not
raise a NOT_SUPPORTED_ERR
exception for the same version
number when using Document.xmlVersion
.setXmlVersion
in interface Document
DOMException
- NOT_SUPPORTED_ERR: Raised if the version is set to a value that is
not supported by this Document
or if this document
does not support the "XML" feature.Copyright © 2014 Apache XML Project. All Rights Reserved.