find Next XML Element - Android XML

Android examples for XML:XML Element

Description

find Next XML Element

Demo Code


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

public class Main {
    public static Element findNextElement(Node ret, String name) {
        ret = ret.getNextSibling();/*from  w  ww  .j  a va  2  s  .  c o m*/
        while (ret != null
                && (!(ret instanceof Element) || !ret.getNodeName().equals(
                        name))) {
            ret = ret.getNextSibling();
        }
        return (Element) ret;
    }
}

Related Tutorials