Java tutorial
//package com.java2s; // License as published by the Free Software Foundation; either import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { public static Element getNextSiblingElement(Element element) { try { Node node = element.getNextSibling(); while (node != null && !(node instanceof Element)) { node = node.getNextSibling(); } return (Element) node; } catch (IndexOutOfBoundsException e) { // Android 1.6 throws IndexOutOfBoundsException instead of correctly returning null return null; } } }