Here you can find the source of getNextSiblingElement(Node node)
public static Element getNextSiblingElement(Node node)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { public static Element getNextSiblingElement(Node node) { Node n = node.getNextSibling(); while (n != null && n.getNodeType() != Node.ELEMENT_NODE) { n = n.getNextSibling();//from w w w .j ava 2s . c o m } return (Element) n; } }