public interface ElementTraversal
ElementTraversal
interface 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 Element
must also implement the ElementTraversal
interface. Four of the methods,
getFirstElementChild()
, getLastElementChild()
,
getPreviousElementSibling()
, and getNextElementSibling()
,
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.
Modifier and Type | Method | Description |
---|---|---|
int |
getChildElementCount() |
Returns the current number of child nodes of the element which are of
the
Element type. |
Element |
getFirstElementChild() |
Returns a reference to the first child node of the element which is of
the
Element type. |
Element |
getLastElementChild() |
Returns a reference to the last child node of the element which is of
the
Element type. |
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 the
Element type. |
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 the
Element type. |
Element getFirstElementChild()
Element
type.null
if the element has
no child of the Element
type.Element getLastElementChild()
Element
type.null
if the element has
no child of the Element
type.Element getPreviousElementSibling()
Element
type.null
if the element has
no sibling node of the Element
type that comes before this one.Element getNextElementSibling()
Element
type.null
if the element has
no sibling node of the Element
type that comes after this one.int getChildElementCount()
Element
type.0
if the element has
no element children. Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2017, Oracle and/or its affiliates. 500 Oracle Parkway
Redwood Shores, CA 94065 USA. All rights reserved.
DRAFT 9-internal+0-adhoc.mlchung.jdk9-jdeps