Package org.w3c.dom
Interface ElementTraversal
-
public interface ElementTraversalTheElementTraversalinterface is a set of read-only attributes which allow an author to easily navigate between elements in a document.In conforming implementations of Element Traversal, all objects that implement
Elementmust also implement theElementTraversalinterface. Four of the methods,getFirstElementChild(),getLastElementChild(),getPreviousElementSibling(), andgetNextElementSibling(), each return a live reference to another element with the defined relationship to the current element, if the related element exists. The fifth method,getChildElementCount(), exposes the number of child elements of an element, for preprocessing before navigation.See also the Element Traversal Specification.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetChildElementCount()Returns the current number of element nodes that are children of this element.ElementgetFirstElementChild()Returns the first child element node of this element.ElementgetLastElementChild()Returns the last child element node of this element.ElementgetNextElementSibling()Returns the next sibling element node of this element.ElementgetPreviousElementSibling()Returns the previous sibling element node of this element.
-
-
-
Method Detail
-
getFirstElementChild
Element getFirstElementChild()
Returns the first child element node of this element.nullif this element has no child elements.
-
getLastElementChild
Element getLastElementChild()
Returns the last child element node of this element.nullif this element has no child elements.
-
getPreviousElementSibling
Element getPreviousElementSibling()
Returns the previous sibling element node of this element.nullif this element has no element sibling nodes that come before this one in the document tree.
-
getNextElementSibling
Element getNextElementSibling()
Returns the next sibling element node of this element.nullif this element has no element sibling nodes that come after this one in the document tree.
-
getChildElementCount
int getChildElementCount()
Returns the current number of element nodes that are children of this element.0if this element has no child nodes that are ofnodeType1.
-
-