Java XML Node Sibiling getPreHomoSibling(Node aNode)

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

Description

get Pre Homo Sibling

License

Apache License

Declaration

public static Node getPreHomoSibling(Node aNode) 

Method Source Code

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

import org.w3c.dom.Node;

public class Main {
    public static Node getPreHomoSibling(Node aNode) {
        Node preSibling = aNode;//from   w  w w. j a  v  a2  s.  com
        while ((preSibling = preSibling.getPreviousSibling()) != null) {
            if (preSibling.getNodeName().equals(aNode.getNodeName())) {
                return preSibling;
            }
        }
        return null;
    }
}

Related

  1. GetNextSiblingElement(Node start)
  2. getNextSiblingElementByName(Node node, String name)
  3. getNextSiblingElementNS(Node node, String uri)
  4. getNextSiblingElementNS(Node node, String[][] elemNames)
  5. getNextVisibleSiblingElement(Node node)
  6. getPreviousSibling(Node node, short nodeType)
  7. getPreviousSiblingByName(Node currentNode, String tagName)
  8. getPreviousSiblingElement(Node node)
  9. getPreviousSiblingElement(Node node)