-
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 provides 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.- Since:
- 9
- See Also:
- Element Traversal Specification
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetChildElementCount()Returns the current number of child nodes of the element which are of theElementtype.ElementgetFirstElementChild()Returns a reference to the first child node of the element which is of theElementtype.ElementgetLastElementChild()Returns a reference to the last child node of the element which is of theElementtype.ElementgetNextElementSibling()Returns a reference to the sibling node of the element which most immediately follows the element in document order, and which is of theElementtype.ElementgetPreviousElementSibling()Returns a reference to the sibling node of the element which most immediately precedes the element in document order, and which is of theElementtype.
-
-
-
Method Detail
-
getFirstElementChild
Element getFirstElementChild()
Returns a reference to the first child node of the element which is of theElementtype.- Returns:
- a reference to an element child,
nullif the element has no child of theElementtype.
-
getLastElementChild
Element getLastElementChild()
Returns a reference to the last child node of the element which is of theElementtype.- Returns:
- a reference to an element child,
nullif the element has no child of theElementtype.
-
getPreviousElementSibling
Element getPreviousElementSibling()
Returns a reference to the sibling node of the element which most immediately precedes the element in document order, and which is of theElementtype.- Returns:
- a reference to an element child,
nullif the element has no sibling node of theElementtype that comes before this one.
-
getNextElementSibling
Element getNextElementSibling()
Returns a reference to the sibling node of the element which most immediately follows the element in document order, and which is of theElementtype.- Returns:
- a reference to an element child,
nullif the element has no sibling node of theElementtype that comes after this one.
-
getChildElementCount
int getChildElementCount()
Returns the current number of child nodes of the element which are of theElementtype.- Returns:
- the number of element children, or
0if the element has no element children.
-
-