Get sibling node from XML Node - Android XML

Android examples for XML:XML Node

Description

Get sibling node from XML Node

Demo Code


//package com.java2s;

import org.w3c.dom.Node;

public class Main {


    public static Node getNextHomoSibling(Node aNode) {
        Node nextSibling = aNode;
        while ((nextSibling = nextSibling.getNextSibling()) != null) {
            if (nextSibling.getNodeName().equals(aNode.getNodeName())) {
                return nextSibling;
            }//from w ww  .  j  a v a2 s.c  o m
        }
        return null;
    }
}

Related Tutorials