Java XML Node Sibiling getNextElementSibling(Node node)

Here you can find the source of getNextElementSibling(Node node)

Description

Returns the next sibling element of the given node.

License

Open Source License

Parameter

Parameter Description
node the given node

Return

the next sibling element of the given node

Declaration

public static Element getNextElementSibling(Node node) 

Method Source Code

//package com.java2s;

import org.w3c.dom.Element;

import org.w3c.dom.Node;

public class Main {
    /**//  ww  w . j  a  va  2 s  .c  om
     * Returns the next sibling element of the given node.
     * 
     * @param node
     *            the given node
     * @return the next sibling element of the given node
     */
    public static Element getNextElementSibling(Node node) {
        node = node.getNextSibling();
        while (node != null) {
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                return (Element) node;
            }
            node = node.getNextSibling();
        }
        return null;
    }
}

Related

  1. getFirstSiblingElmt(Node aNode)
  2. getFirstSiblingNamed(Node node, String name)
  3. getLocHomoSibling(Node aNode)
  4. getNextElementSibling(Node node)
  5. getNextElementSibling(Node node)
  6. getNextHomoSibling(Node aNode)
  7. getNextNamedSibling(Node node, String nodeName)
  8. getNextNodeSibling(Node node)
  9. getNextSibling(Node node)