Java tutorial
//package com.java2s; import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { public static Element getNextSiblingElement(Node node, final String siblingName) { do { node = node.getNextSibling(); if (node == null) return null; } while (node.getNodeType() != Node.ELEMENT_NODE || !node.getNodeName().equals(siblingName)); return (Element) node; } }