Java examples for XML:DOM Element
This will return the next sibling XML element (skipping Text elements along the way)
//package com.java2s; import org.w3c.dom.*; public class Main { /**/*from w w w. ja va 2 s .co m*/ * This will return the next sibling element (skipping Text elements * along the way) * * @return org.w3c.dom.Element * @param element org.w3c.dom.Element */ public static Element nextElement(Element element) { Node sibling = element.getNextSibling(); while (null != sibling) { if (sibling instanceof Element) return (Element) sibling; // Found one. We're outta here. sibling = sibling.getNextSibling(); } return null; } }