Here you can find the source of getNextElement(Node node)
public static Element getNextElement(Node node)
//package com.java2s; import org.w3c.dom.Node; import org.w3c.dom.Element; public class Main { public static Element getNextElement(Node node) { node = node.getNextSibling();//from w ww . ja va 2 s . c om while (node != null) { if (node.getNodeType() == Node.ELEMENT_NODE) { return (Element) node; } node = node.getNextSibling(); } return null; } }