|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xerces.dom.NodeImpl
public abstract class NodeImpl
NodeImpl provides the basic structure of a DOM tree. It is never used directly, but instead is subclassed to add type and data information, and additional methods, appropriate to each node of the tree. Only its subclasses should be instantiated -- and those, with the exception of Document itself, only through a specific Document's factory methods.
The Node interface provides shared behaviors such as siblings and children, both for consistancy and so that the most common tree operations may be performed without constantly having to downcast to specific node types. When there is no obvious mapping for one of these queries, it will respond with null. Note that the default behavior is that children are forbidden. To permit them, the subclass ParentNode overrides several methods.
NodeImpl also implements NodeList, so it can return itself in response to the getChildNodes() query. This eliminiates the need for a separate ChildNodeList object. Note that this is an IMPLEMENTATION DETAIL; applications should _never_ assume that this identity exists.
All nodes in a single document must originate in that document. (Note that this is much tighter than "must be same implementation") Nodes are all aware of their ownerDocument, and attempts to mismatch will throw WRONG_DOCUMENT_ERR.
However, to save memory not all nodes always have a direct reference to their ownerDocument. When a node is owned by another node it relies on its owner to store its ownerDocument. Parent nodes always store it though, so there is never more than one level of indirection. And when a node doesn't have an owner, ownerNode refers to its ownerDocument.
This class doesn't directly support mutation events, however, it still implements the EventTarget interface and forward all related calls to the document so that the document class do so.
Field Summary | |
---|---|
static short |
DOCUMENT_POSITION_CONTAINS
|
static short |
DOCUMENT_POSITION_DISCONNECTED
|
static short |
DOCUMENT_POSITION_FOLLOWING
|
static short |
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
|
static short |
DOCUMENT_POSITION_IS_CONTAINED
|
static short |
DOCUMENT_POSITION_PRECEDING
|
static short |
ELEMENT_DEFINITION_NODE
Element definition node type. |
static short |
TREE_POSITION_ANCESTOR
The node is an ancestor of the reference node. |
static short |
TREE_POSITION_DESCENDANT
The node is a descendant of the reference node. |
static short |
TREE_POSITION_DISCONNECTED
The two nodes are disconnected, they do not have any common ancestor. |
static short |
TREE_POSITION_EQUIVALENT
The two nodes have an equivalent position. |
static short |
TREE_POSITION_FOLLOWING
The node follows the reference node. |
static short |
TREE_POSITION_PRECEDING
The node precedes the reference node. |
static short |
TREE_POSITION_SAME_NODE
The two nodes are the same. |
Fields inherited from interface org.w3c.dom.Node |
---|
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE |
Constructor Summary | |
---|---|
NodeImpl()
Constructor for serialization. |
Method Summary | |
---|---|
void |
addEventListener(java.lang.String type,
EventListener listener,
boolean useCapture)
This method allows the registration of event listeners on the event target. |
Node |
appendChild(Node newChild)
Adds a child node to the end of the list of children for this node. |
Node |
cloneNode(boolean deep)
Returns a duplicate of a given node. |
short |
compareDocumentPosition(Node other)
Compares a node with this node with regard to their position in the document. |
short |
compareTreePosition(Node other)
Deprecated. |
boolean |
dispatchEvent(Event event)
This method allows the dispatch of events into the implementations event model. |
NamedNodeMap |
getAttributes()
Return the collection of attributes associated with this node, or null if none. |
java.lang.String |
getBaseURI()
The absolute base URI of this node or null if undefined. |
NodeList |
getChildNodes()
Obtain a NodeList enumerating all children of this node. |
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, as specified in . |
Node |
getFirstChild()
The first child of this Node, or null if none. |
Node |
getLastChild()
The first child of this Node, or null if none. |
int |
getLength()
NodeList method: Count the immediate children of this node |
java.lang.String |
getLocalName()
Introduced in DOM Level 2. |
java.lang.String |
getNamespaceURI()
Introduced in DOM Level 2. |
Node |
getNextSibling()
The next child of this node's parent, or null if none |
abstract java.lang.String |
getNodeName()
the name of this node. |
abstract short |
getNodeType()
A short integer indicating what type of node this is. |
java.lang.String |
getNodeValue()
Returns the node value. |
Document |
getOwnerDocument()
Find the Document that this Node belongs to (the document in whose context the Node was created). |
Node |
getParentNode()
Obtain the DOM-tree parent of this node, or null if it is not currently active in the DOM tree (perhaps because it has just been created or removed). |
java.lang.String |
getPrefix()
Introduced in DOM Level 2. |
Node |
getPreviousSibling()
The previous child of this node's parent, or null if none |
boolean |
getReadOnly()
NON-DOM: Returns true if this node is read-only. |
java.lang.String |
getTextContent()
This attribute returns the text content of this node and its descendants. |
java.lang.Object |
getUserData()
NON-DOM: Returns the user data associated to this node. |
java.lang.Object |
getUserData(java.lang.String key)
Retrieves the object associated to a key on a this node. |
boolean |
hasAttributes()
Returns whether this node (if it is an element) has any attributes. |
boolean |
hasChildNodes()
Test whether this node has any children. |
Node |
insertBefore(Node newChild,
Node refChild)
Move one or more node(s) to our list of children. |
boolean |
isDefaultNamespace(java.lang.String namespaceURI)
DOM Level 3: Experimental This method checks if the specified namespaceURI is the
default namespace or not. |
boolean |
isEqualNode(Node arg)
Tests whether two nodes are equal. |
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)
Introduced in DOM Level 2. |
Node |
item(int index)
NodeList method: Return the Nth immediate child of this node, or null if the index is out of bounds. |
java.lang.String |
lookupNamespaceURI(java.lang.String specifiedPrefix)
DOM Level 3 - Experimental: 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 - Experimental: Look up the prefix associated to the given namespace URI, starting from this node. |
void |
needsSyncChildren(boolean value)
|
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 markup (e.g., tags, comments, processing
instructions, CDATA sections, and entity references) separates
Text nodes, i.e., there are no adjacent Text
nodes. |
Node |
removeChild(Node oldChild)
Remove a child from this Node. |
void |
removeEventListener(java.lang.String type,
EventListener listener,
boolean useCapture)
This method allows the removal of event listeners from the event target. |
Node |
replaceChild(Node newChild,
Node oldChild)
Make newChild occupy the location that oldChild used to have. |
void |
setNodeValue(java.lang.String x)
Sets the node value. |
void |
setPrefix(java.lang.String prefix)
Introduced in DOM Level 2. |
void |
setReadOnly(boolean readOnly,
boolean deep)
NON-DOM: PR-DOM-Level-1-19980818 mentions readonly nodes in conjunction with Entities, but provides no API to support this. |
void |
setTextContent(java.lang.String textContent)
This attribute returns the text content of this node and its descendants. |
void |
setUserData(java.lang.Object data)
NON-DOM: As an alternative to subclassing the DOM, this implementation has been extended with the ability to attach an object to each node. |
java.lang.Object |
setUserData(java.lang.String key,
java.lang.Object data,
UserDataHandler handler)
Associate an object to a key on this node. |
java.lang.String |
toString()
NON-DOM method for debugging convenience. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final short TREE_POSITION_PRECEDING
public static final short TREE_POSITION_FOLLOWING
public static final short TREE_POSITION_ANCESTOR
public static final short TREE_POSITION_DESCENDANT
public static final short TREE_POSITION_EQUIVALENT
ownerElement
, and two
nodes that are the same.
public static final short TREE_POSITION_SAME_NODE
public static final short TREE_POSITION_DISCONNECTED
public static final short DOCUMENT_POSITION_DISCONNECTED
public static final short DOCUMENT_POSITION_PRECEDING
public static final short DOCUMENT_POSITION_FOLLOWING
public static final short DOCUMENT_POSITION_CONTAINS
public static final short DOCUMENT_POSITION_IS_CONTAINED
public static final short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
public static final short ELEMENT_DEFINITION_NODE
Constructor Detail |
---|
public NodeImpl()
Method Detail |
---|
public abstract short getNodeType()
getNodeType
in interface Node
public abstract java.lang.String getNodeName()
getNodeName
in interface Node
public java.lang.String getNodeValue() throws DOMException
getNodeValue
in interface Node
DOMException(DOMSTRING_SIZE_ERR)
DOMException
- DOMSTRING_SIZE_ERR: Raised when it would return more characters than
fit in a DOMString
variable on the implementation
platform.public void setNodeValue(java.lang.String x) throws DOMException
setNodeValue
in interface Node
DOMException(NO_MODIFICATION_ALLOWED_ERR)
DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly and if
it is not defined to be null
.public Node appendChild(Node newChild) throws DOMException
appendChild
in interface Node
newChild
- The node to add.If it is a
DocumentFragment
object, the entire contents of the
document fragment are moved into the child list of this node
DOMException(HIERARCHY_REQUEST_ERR)
- if newChild is of a
type that shouldn't be a child of this node.
DOMException(WRONG_DOCUMENT_ERR)
- if newChild has a
different owner document than we do.
DOMException(NO_MODIFICATION_ALLOWED_ERR)
- if this node is
read-only.
DOMException
- HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
allow children of the type of the newChild
node, or if
the node to append is one of this node's ancestors or this node
itself, or if this node is of type Document
and the
DOM application attempts to append a second
DocumentType
or Element
node.
newChild
was created
from a different document than the one that created this node.
newChild
node is a child
of the Document
node, this exception might be raised
if the DOM implementation doesn't support the removal of the
DocumentType
child or Element
child.
By default we do not accept any children, ParentNode overrides this.
,
ParentNode
public Node cloneNode(boolean deep)
Note: since we never have any children deep is meaningless here, ParentNode overrides this behavior.
cloneNode
in interface Node
deep
- If true
, recursively clone the subtree under
the specified node; if false
, clone only the node
itself (and its attributes, if it is an Element
).
Example: Cloning a Text node will copy both the node and the text it
contains.
Example: Cloning something that has children -- Element or Attr, for
example -- will _not_ clone those children unless a "deep clone"
has been requested. A shallow clone of an Attr node will yield an
empty Attr of the same name.
NOTE: Clones will always be read/write, even if the node being cloned
is read-only, to permit applications using only the DOM API to obtain
editable copies of locked portions of the tree.
public Document getOwnerDocument()
getOwnerDocument
in interface Node
public Node getParentNode()
getParentNode
in interface Node
public Node getNextSibling()
getNextSibling
in interface Node
public Node getPreviousSibling()
getPreviousSibling
in interface Node
public NamedNodeMap getAttributes()
getAttributes
in interface Node
ElementImpl
public boolean hasAttributes()
hasAttributes
in interface Node
true
if this node has any attributes,
false
otherwise.ElementImpl
public boolean hasChildNodes()
By default we do not have any children, ParentNode overrides this.
hasChildNodes
in interface Node
true
if this node has any children,
false
otherwise.ParentNode
public NodeList getChildNodes()
NodeLists are "live"; as children are added/removed the NodeList will immediately reflect those changes. Also, the NodeList refers to the actual nodes, so changes to those nodes made via the DOM tree will be reflected in the NodeList and vice versa.
In this implementation, Nodes implement the NodeList interface and provide their own getChildNodes() support. Other DOMs may solve this differently.
getChildNodes
in interface Node
public Node getFirstChild()
By default we do not have any children, ParentNode overrides this.
getFirstChild
in interface Node
ParentNode
public Node getLastChild()
By default we do not have any children, ParentNode overrides this.
getLastChild
in interface Node
ParentNode
public Node insertBefore(Node newChild, Node refChild) throws DOMException
By default we do not accept any children, ParentNode overrides this.
insertBefore
in interface Node
newChild
- The Node to be moved to our subtree. As a
convenience feature, inserting a DocumentNode will instead insert
all its children.refChild
- Current child which newChild should be placed
immediately before. If refChild is null, the insertion occurs
after all existing Nodes, like appendChild().
DOMException(HIERARCHY_REQUEST_ERR)
- if newChild is of a
type that shouldn't be a child of this node, or if newChild is an
ancestor of this node.
DOMException(WRONG_DOCUMENT_ERR)
- if newChild has a
different owner document than we do.
DOMException(NOT_FOUND_ERR)
- if refChild is not a child of
this node.
DOMException(NO_MODIFICATION_ALLOWED_ERR)
- if this node is
read-only.
DOMException
- HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
allow children of the type of the newChild
node, or if
the node to insert is one of this node's ancestors or this node
itself, or if this node is of type Document
and the
DOM application attempts to insert a second
DocumentType
or Element
node.
newChild
was created
from a different document than the one that created this node.
refChild
is not a child of
this node.
Document
,
this exception might be raised if the DOM implementation doesn't
support the insertion of a DocumentType
or
Element
node.ParentNode
public Node removeChild(Node oldChild) throws DOMException
By default we do not have any children, ParentNode overrides this.
removeChild
in interface Node
oldChild
- The node being removed.
DOMException(NOT_FOUND_ERR)
- if oldChild is not a child of
this node.
DOMException(NO_MODIFICATION_ALLOWED_ERR)
- if this node is
read-only.
DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
oldChild
is not a child of
this node.
Document
,
this exception might be raised if the DOM implementation doesn't
support the removal of the DocumentType
child or the
Element
child.ParentNode
public Node replaceChild(Node newChild, Node oldChild) throws DOMException
By default we do not have any children, ParentNode overrides this.
replaceChild
in interface Node
newChild
- The new node to put in the child list.oldChild
- The node being replaced in the list.
DOMException(HIERARCHY_REQUEST_ERR)
- if newChild is of a
type that shouldn't be a child of this node, or if newChild is
one of our ancestors.
DOMException(WRONG_DOCUMENT_ERR)
- if newChild has a
different owner document than we do.
DOMException(NOT_FOUND_ERR)
- if oldChild is not a child of
this node.
DOMException(NO_MODIFICATION_ALLOWED_ERR)
- if this node is
read-only.
DOMException
- HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
allow children of the type of the newChild
node, or if
the node to put in is one of this node's ancestors or this node
itself, or if this node is of type Document
and the
result of the replacement operation would add a second
DocumentType
or Element
on the
Document
node.
newChild
was created
from a different document than the one that created this node.
oldChild
is not a child of
this node.
Document
,
this exception might be raised if the DOM implementation doesn't
support the replacement of the DocumentType
child or
Element
child.ParentNode
public int getLength()
By default we do not have any children, ParentNode overrides this.
getLength
in interface NodeList
ParentNode
public Node item(int index)
By default we do not have any children, ParentNode overrides this.
item
in interface NodeList
index
- int
ParentNode
public void normalize()
Text
nodes in the full depth of the sub-tree
underneath this Node
, including attribute nodes, into a
"normal" form where only markup (e.g., tags, comments, processing
instructions, CDATA sections, and entity references) separates
Text
nodes, i.e., there are no adjacent 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 lookups) that depend on a particular
document tree structure are to be used.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.
Note that this implementation simply calls normalize() on this Node's children. It is up to implementors or Node to override normalize() to take action.
normalize
in interface Node
public boolean isSupported(java.lang.String feature, java.lang.String version)
Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.
isSupported
in interface Node
feature
- The package name of the feature to test. This is the same
name as what can be passed to the method hasFeature on
DOMImplementation.version
- This is the version number of the package name to
test. In Level 2, version 1, this is the string "2.0". If the version is
not specified, supporting any version of the feature will cause the
method to return true.
public java.lang.String getNamespaceURI()
The namespace URI of this node, or null if it is unspecified. When this node is of any type other than ELEMENT_NODE and ATTRIBUTE_NODE, this is always null and setting it has no effect.
This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time.
For nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is null.
getNamespaceURI
in interface Node
AttrNSImpl
,
ElementNSImpl
public java.lang.String getPrefix()
The namespace prefix of this node, or null if it is unspecified. When this node is of any type other than ELEMENT_NODE and ATTRIBUTE_NODE this is always null and setting it has no effect.
For nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is null.
getPrefix
in interface Node
AttrNSImpl
,
ElementNSImpl
public void setPrefix(java.lang.String prefix) throws DOMException
The namespace prefix of this node, or null if it is unspecified. When this node is of any type other than ELEMENT_NODE and ATTRIBUTE_NODE this is always null and setting it has no effect.
For nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is null.
Note that setting this attribute changes the nodeName attribute, which holds the qualified name, as well as the tagName and name attributes of the Element and Attr interfaces, when applicable.
setPrefix
in interface Node
INVALID_CHARACTER_ERR
- Raised if the specified
prefix contains an invalid character.
DOMException
- INVALID_CHARACTER_ERR: Raised if the specified prefix contains an
illegal character according to the XML version in use specified in
the Document.xmlVersion
attribute.
prefix
is
malformed per the Namespaces in XML specification, if the
namespaceURI
of this node is null
, if the
specified prefix is "xml" and the namespaceURI
of this
node is different from "
http://www.w3.org/XML/1998/namespace", if this node is an attribute and the specified prefix is "xmlns" and
the namespaceURI
of this node is different from "http://www.w3.org/2000/xmlns/", or if this node is an attribute and the qualifiedName
of
this node is "xmlns" [XML Namespaces]
.AttrNSImpl
,
ElementNSImpl
public java.lang.String getLocalName()
Returns the local part of the qualified name of this node. For nodes created with a DOM Level 1 method, such as createElement from the Document interface, and for nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE this is the same as the nodeName attribute.
getLocalName
in interface Node
AttrNSImpl
,
ElementNSImpl
public void addEventListener(java.lang.String type, EventListener listener, boolean useCapture)
EventTarget
EventListener
is added to an
EventTarget
while it is processing an event, it will not
be triggered by the current actions but may be triggered during a
later stage of event flow, such as the bubbling phase.
EventListener
s are registered
on the same EventTarget
with the same parameters the
duplicate instances are discarded. They do not cause the
EventListener
to be called twice and since they are
discarded they do not need to be removed with the
removeEventListener
method.
addEventListener
in interface EventTarget
type
- The event type for which the user is registeringlistener
- The listener
parameter takes an interface
implemented by the user which contains the methods to be called
when the event occurs.useCapture
- If true, useCapture
indicates that the
user wishes to initiate capture. After initiating capture, all
events of the specified type will be dispatched to the registered
EventListener
before being dispatched to any
EventTargets
beneath them in the tree. Events which
are bubbling upward through the tree will not trigger an
EventListener
designated to use capture.public void removeEventListener(java.lang.String type, EventListener listener, boolean useCapture)
EventTarget
EventListener
is removed from an
EventTarget
while it is processing an event, it will not
be triggered by the current actions. EventListener
s can
never be invoked after being removed.
removeEventListener
with arguments which do
not identify any currently registered EventListener
on
the EventTarget
has no effect.
removeEventListener
in interface EventTarget
type
- Specifies the event type of the EventListener
being removed.listener
- The EventListener
parameter indicates the
EventListener
to be removed.useCapture
- Specifies whether the EventListener
being removed was registered as a capturing listener or not. If a
listener was registered twice, one with capture and one without,
each must be removed separately. Removal of a capturing listener
does not affect a non-capturing version of the same listener, and
vice versa.public boolean dispatchEvent(Event event)
EventTarget
EventTarget
on which dispatchEvent
is
called.
dispatchEvent
in interface EventTarget
event
- Specifies the event type, behavior, and contextual
information to be used in processing the event.
dispatchEvent
indicates
whether any of the listeners which handled the event called
preventDefault
. If preventDefault
was
called the value is false, else the value is true.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 short compareTreePosition(Node other)
other
- The node to compare against this node.
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 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 |
---|
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 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 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 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 java.lang.String lookupNamespaceURI(java.lang.String specifiedPrefix)
lookupNamespaceURI
in interface Node
specifiedPrefix
-
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.
true
otherwise false
.public java.lang.Object getFeature(java.lang.String feature, java.lang.String version)
Node
Node
interface.
getFeature
in interface Node
feature
- The name of the feature requested. Note that any plus
sign "+" prepended to the name of the feature will be ignored since
it is not significant in the context of this method.version
- This is the version number of the feature to test.
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 java.lang.Object setUserData(java.lang.String key, java.lang.Object data, UserDataHandler handler)
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
.
DOMObject
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 void setReadOnly(boolean readOnly, boolean deep)
Most DOM users should not touch this method. Its anticpated use is during construction of EntityRefernces, where it will be used to lock the contents replicated from Entity so they can't be casually altered. It _could_ be published as a DOM extension, if desired.
Note: since we never have any children deep is meaningless here, ParentNode overrides this behavior.
readOnly
- True or false as desired.deep
- If true, children are also toggled. Note that this will
not change the state of an EntityReference or its children,
which are always read-only.ParentNode
public boolean getReadOnly()
public void setUserData(java.lang.Object data)
Important Note: You are responsible for removing references to your data on nodes that are no longer used. Failure to do so will prevent the nodes, your data is attached to, to be garbage collected until the whole document is.
data
- the object to store or null to remove any existing referencepublic java.lang.Object getUserData()
public final void needsSyncChildren(boolean value)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |