code: public static boolean isNodeTheSame(Node node1, Node node2)
    {
      if (node1 instanceof DTMNodeProxy && node2 instanceof DTMNodeProxy)
        return ((DTMNodeProxy)node1).equals((DTMNodeProxy)node2);
      else
        return (node1 == node2);
    }
docs: Use DTMNodeProxy to determine whether two nodes are the same.
  
  @param node1 The first DOM node to compare.
  @param node2 The second DOM node to compare.
  @return true if the two nodes are the same.