Java XML Node Sibiling getNextHomoSibling(Node aNode)

Here you can find the source of getNextHomoSibling(Node aNode)

Description

this function is different from above one.

License

Apache License

Parameter

Parameter Description
n a parameter
name a parameter

Declaration


public static Node getNextHomoSibling(Node aNode) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import org.w3c.dom.Node;

public class Main {
    /**/*from  www. j a v  a 2 s .  c  o  m*/
     * this function is different from above one. Though we still aim at finding
     * the node with the name. But we don't want to surpass some line. Say, if
     * the current Node is sourceOf, we don't want to go down to another
     * sourceOf which is under the current sourceOf.
     * 
     * @param n
     * @param name
     * @return
     */

    public static Node getNextHomoSibling(Node aNode) {
        Node nextSibling = aNode;
        while ((nextSibling = nextSibling.getNextSibling()) != null) {
            if (nextSibling.getNodeName().equals(aNode.getNodeName())) {
                return nextSibling;
            }
        }
        return null;
    }
}

Related

  1. getFirstSiblingNamed(Node node, String name)
  2. getLocHomoSibling(Node aNode)
  3. getNextElementSibling(Node node)
  4. getNextElementSibling(Node node)
  5. getNextElementSibling(Node node)
  6. getNextNamedSibling(Node node, String nodeName)
  7. getNextNodeSibling(Node node)
  8. getNextSibling(Node node)
  9. getNextSiblingElement(Node n)