jaxp/src/java.xml/share/classes/org/w3c/dom/ElementTraversal.java
author joehw
Fri, 25 Sep 2015 16:42:19 -0700
changeset 32791 ed81078b4e7f
child 32901 42af6bc4d36a
permissions -rw-r--r--
8135283: DOM API update: Element Traversal Specification Reviewed-by: mchung, lancea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32791
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
     1
/*
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
     3
 *
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
     6
 * published by the Free Software Foundation.  Oracle designates this
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
     7
 * particular file as subject to the "Classpath" exception as provided
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
     8
 * by Oracle in the LICENSE file that accompanied this code.
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
     9
 *
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    14
 * accompanied this code).
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    15
 *
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    19
 *
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    22
 * questions.
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    23
 */
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    24
/*
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    25
 * Copyright (c) 2015 World Wide Web Consortium,
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    26
 *
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    27
 * (Massachusetts Institute of Technology, European Research Consortium for
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    28
 * Informatics and Mathematics, Keio University, Beihang). All Rights Reserved.
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    29
 * This work is distributed under the W3C(r) Software License [1] in the hope that
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    30
 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    31
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    32
 *
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    33
 * [1] http://www.w3.org/Consortium/Legal/copyright-software
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    34
 */
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    35
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    36
package org.w3c.dom;
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    37
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    38
/**
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    39
 * The {@code ElementTraversal} interface is a set of read-only attributes
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    40
 * which allow an author to easily navigate between elements in a document.
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    41
 * <p>
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    42
 * In conforming implementations of Element Traversal, all objects that
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    43
 * implement {@link Element} must also implement the {@code ElementTraversal}
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    44
 * interface. Four of the methods,
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    45
 * {@link #getFirstElementChild}, {@link #getLastElementChild},
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    46
 * {@link #getPreviousElementSibling}, and {@link #getNextElementSibling},
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    47
 * each provides a live reference to another element with the defined
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    48
 * relationship to the current element, if the related element exists. The
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    49
 * fifth method, {@link #getChildElementCount}, exposes the number of child
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    50
 * elements of an element, for preprocessing before navigation.
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    51
 *
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    52
 * @see
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    53
 * <a href='http://www.w3.org/TR/ElementTraversal/'><cite>Element Traversal Specification</cite></a>.
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    54
 *
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    55
 * @since 9
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    56
 */
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    57
public interface ElementTraversal {
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    58
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    59
    /**
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    60
     * Returns a reference to the first child node of the element which is of
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    61
     * the {@link Element} type.
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    62
     *
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    63
     * @return a reference to an element child, {@code null} if the element has
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    64
     * no child of the {@link Element} type.
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    65
     */
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    66
    Element getFirstElementChild();
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    67
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    68
    /**
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    69
     * Returns a reference to the last child node of the element which is of
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    70
     * the {@link Element} type.
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    71
     *
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    72
     * @return a reference to an element child, {@code null} if the element has
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    73
     * no child of the {@link Element} type.
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    74
     */
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    75
    Element getLastElementChild();
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    76
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    77
    /**
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    78
     * Returns a reference to the sibling node of the element which most immediately
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    79
     * precedes the element in document order, and which is of the {@link Element} type.
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    80
     *
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    81
     * @return a reference to an element child, {@code null} if the element has
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    82
     * no sibling node of the {@link Element} type that comes before this one.
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    83
     */
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    84
    Element getPreviousElementSibling();
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    85
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    86
    /**
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    87
     * Returns a reference to the sibling node of the element which most immediately
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    88
     * follows the element in document order, and which is of the {@link Element} type.
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    89
     *
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    90
     * @return a reference to an element child, {@code null} if the element has
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    91
     * no sibling node of the {@link Element} type that comes after this one.
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    92
     */
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    93
    Element getNextElementSibling();
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    94
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    95
    /**
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    96
     * Returns the current number of child nodes of the element which are of
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    97
     * the {@link Element} type.
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    98
     *
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
    99
     * @return the number of element children, or {@code 0} if the element has
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
   100
     * no element children.
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
   101
     */
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
   102
    int getChildElementCount();
ed81078b4e7f 8135283: DOM API update: Element Traversal Specification
joehw
parents:
diff changeset
   103
}