Here you can find the source of getNodePath(Node node)
public static String getNodePath(Node node)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Node; public class Main { public static String getNodePath(Node node) { StringBuffer sb = new StringBuffer(32); while (node != null) { sb.append(node.getNodeName()); sb.append("/"); node = node.getParentNode(); }/*ww w . j a va 2 s .co m*/ return sb.toString(); } }