Here you can find the source of getLocHomoSibling(Node aNode)
Parameter | Description |
---|---|
aNode | a parameter |
public static int getLocHomoSibling(Node aNode)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Node; public class Main { /**//www .j a v a 2 s . c o m * aims at finding the location of the current node of its kind. the idea is * to count how many previous siblings does it have, * * @param aNode * @return */ public static int getLocHomoSibling(Node aNode) { int countOfBranch = 0; Node preSibling = aNode; while ((preSibling = preSibling.getPreviousSibling()) != null) { if (preSibling.getNodeName().equals(aNode.getNodeName())) { countOfBranch++; } } return countOfBranch; } }