public static String getPath(DTM dtm, int node) {
    String pre;
    switch (dtm.getNodeType(node)) {
      case Node.DOCUMENT_NODE:
        return "/";
      case Node.ELEMENT_NODE:
        pre = getPath(dtm, dtm.getParent(node));
        return (pre.equals("/") ? "" : pre) +
               "/" + dtm.getNodeName(node) + "[" + getNumberSimple(dtm, node) + "]";
      case Node.ATTRIBUTE_NODE:
        return getPath(dtm, dtm.getParent(node)) + "/@" + dtm.getNodeNameX(node);
      case Node.TEXT_NODE:
        pre = getPath(dtm, dtm.getParent(node));
        return (pre.equals("/") ? "" : pre) +
               "/text()[" + getNumberSimple(dtm, node) + "]";
      case Node.COMMENT_NODE:
        pre = getPath(dtm, dtm.getParent(node));
        return (pre.equals("/") ? "" : pre) +
               "/comment()[" + getNumberSimple(dtm, node) + "]";
      case Node.PROCESSING_INSTRUCTION_NODE:
        pre = getPath(dtm, dtm.getParent(node));
        return (pre.equals("/") ? "" : pre) +
               "/processing-instruction()[" + getNumberSimple(dtm, node) + "]";
    }
    return "?";
  }
public static String getPath(DTM dtm, int node)