|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.ercp.xml.dom.NodeImpl
org.eclipse.ercp.xml.dom.NSNodeImpl
org.eclipse.ercp.xml.dom.TreeNode
public abstract class TreeNode
Support previous and next siblings
Field Summary | |
---|---|
protected TreeNode |
firstChild
|
protected TreeNode |
lastChild
|
protected int |
length
|
protected TreeNode |
nextSibling
|
protected TreeNode |
parentNode
|
protected TreeNode |
previousSibling
|
Fields inherited from class org.eclipse.ercp.xml.dom.NSNodeImpl |
---|
localName, namespaceURI, prefix, qualifiedName |
Fields inherited from class org.eclipse.ercp.xml.dom.NodeImpl |
---|
ownerDocument |
Fields inherited from interface org.w3c.dom.Node |
---|
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE |
Constructor Summary | |
---|---|
TreeNode(DocumentImpl ownerDocument)
Constructor for SiblingNode |
|
TreeNode(DocumentImpl ownerDocument,
java.lang.String qualifiedName)
|
|
TreeNode(DocumentImpl ownerDocument,
java.lang.String namespaceURI,
java.lang.String qualifiedName)
|
Method Summary | |
---|---|
Node |
appendChild(Node newChild)
Adds the node newChild to the end of the list of children
of this node. |
protected void |
getElementByTagName(java.lang.String name,
NodeListImpl list)
|
NodeList |
getElementsByTagName(java.lang.String name)
Returns a NodeList of all descendant Elements
with a given tag name, in the order in which they are encountered in
a preorder traversal of this Element tree. |
NodeList |
getElementsByTagNameNS(java.lang.String namespaceURI,
java.lang.String localName)
Returns a NodeList of all the descendant
Elements with a given local name and namespace URI in
the order in which they are encountered in a preorder traversal of
this Element tree. |
Node |
getFirstChild()
The first child of this node. |
Node |
getLastChild()
The last child of this node. |
int |
getLength()
The number of nodes in the list. |
Node |
getNextSibling()
The node immediately following this node. |
Node |
getParentNode()
The parent of this node. |
Node |
getPreviousSibling()
The node immediately preceding 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 |
item(int index)
Returns the index th item in the collection. |
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. |
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. |
Methods inherited from class org.eclipse.ercp.xml.dom.NSNodeImpl |
---|
getLocalName, getNamespaceURI, getNodeName, getPrefix, setPrefix |
Methods inherited from class org.eclipse.ercp.xml.dom.NodeImpl |
---|
getAttributes, getChildNodes, getNodeValue, getOwnerDocument, hasAttributes, isSupported, setNodeValue, spreadOwnerDocument |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.w3c.dom.Node |
---|
cloneNode, getNodeType |
Field Detail |
---|
protected TreeNode nextSibling
protected TreeNode previousSibling
protected TreeNode parentNode
protected TreeNode firstChild
protected TreeNode lastChild
protected int length
Constructor Detail |
---|
public TreeNode(DocumentImpl ownerDocument)
public TreeNode(DocumentImpl ownerDocument, java.lang.String qualifiedName)
public TreeNode(DocumentImpl ownerDocument, java.lang.String namespaceURI, java.lang.String qualifiedName)
Method Detail |
---|
public Node insertBefore(Node newChild, Node refChild) throws DOMException
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.
insertBefore
in interface Node
insertBefore
in class NodeImpl
newChildThe
- node to insert.refChildThe
- reference node, i.e., the node before which the new
node must be inserted.
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.
newChild
was created
from a different document than the one that created this node.
refChild
is not a child of
this node.public Node removeChild(Node oldChild) throws DOMException
oldChild
from the list
of children, and returns it.
removeChild
in interface Node
removeChild
in class NodeImpl
oldChildThe
- node being removed.
DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
oldChild
is not a child of
this node.public Node appendChild(Node newChild) throws DOMException
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
appendChild
in class NodeImpl
newChildThe
- 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: 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.
newChild
was created
from a different document than the one that created this node.
public Node replaceChild(Node newChild, Node oldChild) throws DOMException
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.
replaceChild
in interface Node
replaceChild
in class NodeImpl
newChildThe
- new node to put in the child list.oldChildThe
- node being replaced in the list.
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.
newChild
was created
from a different document than the one that created this node.
oldChild
is not a child of
this node.public Node getFirstChild()
null
.
getFirstChild
in interface Node
getFirstChild
in class NodeImpl
public Node getLastChild()
null
.
getLastChild
in interface Node
getLastChild
in class NodeImpl
public Node getPreviousSibling()
null
.
getPreviousSibling
in interface Node
getPreviousSibling
in class NodeImpl
public Node getNextSibling()
null
.
getNextSibling
in interface Node
getNextSibling
in class NodeImpl
public boolean hasChildNodes()
hasChildNodes
in interface Node
hasChildNodes
in class NodeImpl
true
if this node has any children,
false
otherwise.public int getLength()
length-1
inclusive.
getLength
in interface NodeList
getLength
in class NodeImpl
public Node getParentNode()
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
getParentNode
in class NodeImpl
public Node item(int index)
index
th item in the collection. If
index
is greater than or equal to the number of nodes in
the list, this returns null
.
item
in interface NodeList
item
in class NodeImpl
index
- Index into the collection.
index
th position in the
NodeList
, or null
if that is not a valid
index.public NodeList getElementsByTagName(java.lang.String name)
NodeList
of all descendant Elements
with a given tag name, in the order in which they are encountered in
a preorder traversal of this Element
tree.
nameThe
- name of the tag to match on. The special value "*"
matches all tags.
Element
nodes.protected void getElementByTagName(java.lang.String name, NodeListImpl list)
public NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
NodeList
of all the descendant
Elements
with a given local name and namespace URI in
the order in which they are encountered in a preorder traversal of
this Element
tree.
namespaceURIThe
- namespace URI of the elements to match on. The
special value "*" matches all namespaces.localNameThe
- local name of the elements to match on. The
special value "*" matches all local names.
NodeList
object containing all the matched
Elements
.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 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 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.
normalize
in interface Node
normalize
in class NodeImpl
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |