Here you can find the source of getNextSiblingElement(Element element)
public static Element getNextSiblingElement(Element element)
//package com.java2s; // Metawidget (licensed under LGPL) import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { public static Element getNextSiblingElement(Element element) { try {//from www. j a v a2s .c om 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; } } }