find Next XML Sibling Element - Android XML

Android examples for XML:XML Element

Description

find Next XML Sibling Element

Demo Code


//package com.java2s;
import org.w3c.dom.Element;

public class Main {
    public static Element findNextSiblingElement(Element current) {
        org.w3c.dom.Node ret = current.getNextSibling();
        while (ret != null) {
            if (ret instanceof Element) {
                return (Element) ret;
            }//from w w  w.j  a va 2s. com
            ret = ret.getNextSibling();
        }
        return null;
    }
}

Related Tutorials