public static String getNodePath(Node n, String sep) {
        if (n == null) {
            return "";
        }
        StringBuffer ret = new StringBuffer(n.getNodeName());
        while ((n.getParentNode() != null) && !(n.getParentNode() instanceof Document)) {
            n = n.getParentNode();
            ret.insert(0, sep).insert(0, n.getNodeName());
        }
        return ret.toString();
    }
Returns the path to the given xml node, where each node name is separated by the given separator string.

@param n the xml node to find path to
@param sep the separator string
@return the path to the xml node as a String
vespajlib/src/main/java/com/yahoo/text/XML.java