|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
Node
public Node
The Node interface is the primary datatype for the entire Document Object Model.
It represents a single node in the document tree.
While all objects implementing the Node interface expose methods for dealing with children,
not all objects implementing the Node interface may have children.
For example, Text nodes may not have children, and adding children to such nodes results in a DOMException being raised.
The attributes nodeName, nodeValue and attributes are included as a mechanism to get at node information without casting down to the specific derived interface.
In cases where there is no obvious mapping of these attributes for a specific nodeType (e.g., nodeValue for an Element or attributes for a Comment), this returns null.
Note that the specialized interfaces may contain additional and more convenient mechanisms to get and set the relevant information.
| Interface | nodeName | nodeValue | attributes |
|---|---|---|---|
| Attr | name of attribute | value of attribute | null |
| CDATASection | #cdata-section | content of the CDATA Section | null |
| Comment | #comment | content of the comment | null |
| Document | #document | null |
null |
| DocumentFragment | #document-fragment | null |
null |
| DocumentType | document type name | null |
null |
| Element | tag name | null |
NamedNodeMap |
| Entity | entity name | null |
null |
| EntityReference | name of entity referenced | null |
null |
| Notation | notation name | null |
null |
| ProcessingInstruction | target | entire content excluding the target | null |
| Text | #text | content of the text node | null |
| Field Summary | |
|---|---|
NodeList |
childNodes
A NodeList that contains all children of this node. |
Node |
firstChild
The first child of this node. |
Node |
lastChild
The last child of this node. |
Node |
nextSibling
The node immediately following this node. |
String |
nodeName
The name of this node, depending on its type; see the table above. |
Number |
nodeType
A code representing the type of the underlying object, as defined above. |
String |
nodeValue
The value of this node, depending on its type; see the table above. |
Document |
ownerDocument
The Document object associated with this node. |
Node |
parentNode
|
Node |
previousSibling
The node immediately preceding this node. |
| Method Summary | |
|---|---|
Node |
appendChild(Node newChild)
Adds the node newChild to the end of the list of children of this node. |
boolean |
hasChildNodes()
Returns whether this node has any children. |
Node |
insertBefore(Node newChild,
Node refChild)
Inserts the node newChild before the existing child node refChild. |
Node |
removeChild(Node oldChild)
Removes the child node indicated by oldChild from the list of children, and returns it. |
Node |
replaceChild(Node newChild,
Node oldChild)
Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node. |
| Field Detail |
|---|
final Node previousSibling
null.
final Node parentNode
final Node firstChild
null.
final String nodeValue
null, setting it has no effect.
final String nodeName
final NodeList childNodes
final Number nodeType
final Document ownerDocument
null.
final Node nextSibling
null.
final Node lastChild
null.
| Method Detail |
|---|
final Node removeChild(Node oldChild)
oldChild from the list of children, and returns it.
oldChild - The node being removed.
final Node insertBefore(Node newChild,
Node refChild)
null, insert newChild at the end of the list of children.
If 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.
newChild - The node to insert.refChild - The reference node, i.e., the node before which the new node must be inserted.
final boolean hasChildNodes()
true if this node has any children, false otherwise.final Node appendChild(Node newChild)
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
final Node replaceChild(Node newChild,
Node oldChild)
newChild - The new node to put in the child list.oldChild - The node being replaced in the list.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||