Path: blob/master/src/java.xml/share/classes/org/w3c/dom/ElementTraversal.java
40948 views
/*1* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation. Oracle designates this6* particular file as subject to the "Classpath" exception as provided7* by Oracle in the LICENSE file that accompanied this code.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*/23/*24* Copyright (c) 2015 World Wide Web Consortium,25*26* (Massachusetts Institute of Technology, European Research Consortium for27* Informatics and Mathematics, Keio University, Beihang). All Rights Reserved.28* This work is distributed under the W3C(r) Software License [1] in the hope that29* it will be useful, but WITHOUT ANY WARRANTY; without even the implied30* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.31*32* [1] http://www.w3.org/Consortium/Legal/copyright-software33*/3435package org.w3c.dom;3637/**38* The {@code ElementTraversal} interface is a set of read-only attributes39* which allow an author to easily navigate between elements in a document.40* <p>41* In conforming implementations of Element Traversal, all objects that42* implement {@link Element} must also implement the {@code ElementTraversal}43* interface. Four of the methods,44* {@link #getFirstElementChild}, {@link #getLastElementChild},45* {@link #getPreviousElementSibling}, and {@link #getNextElementSibling},46* each provides a live reference to another element with the defined47* relationship to the current element, if the related element exists. The48* fifth method, {@link #getChildElementCount}, exposes the number of child49* elements of an element, for preprocessing before navigation.50*51* @see52* <a href='http://www.w3.org/TR/ElementTraversal/'><cite>Element Traversal Specification</cite></a>53*54* @since 955*/56public interface ElementTraversal {5758/**59* Returns a reference to the first child node of the element which is of60* the {@link Element} type.61*62* @return a reference to an element child, {@code null} if the element has63* no child of the {@link Element} type.64*/65Element getFirstElementChild();6667/**68* Returns a reference to the last child node of the element which is of69* the {@link Element} type.70*71* @return a reference to an element child, {@code null} if the element has72* no child of the {@link Element} type.73*/74Element getLastElementChild();7576/**77* Returns a reference to the sibling node of the element which most immediately78* precedes the element in document order, and which is of the {@link Element} type.79*80* @return a reference to an element child, {@code null} if the element has81* no sibling node of the {@link Element} type that comes before this one.82*/83Element getPreviousElementSibling();8485/**86* Returns a reference to the sibling node of the element which most immediately87* follows the element in document order, and which is of the {@link Element} type.88*89* @return a reference to an element child, {@code null} if the element has90* no sibling node of the {@link Element} type that comes after this one.91*/92Element getNextElementSibling();9394/**95* Returns the current number of child nodes of the element which are of96* the {@link Element} type.97*98* @return the number of element children, or {@code 0} if the element has99* no element children.100*/101int getChildElementCount();102}103104105