get Next Homo Sibling from XML Node - Java XML

Java examples for XML:DOM Node Value

Description

get Next Homo Sibling 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  www  .j  a  v a 2  s.  c om
        }
        return null;
    }
}

Related Tutorials