code: public static int nodeHashCode(final Node node) {
          assert node != null;
          int hash = 1 + node.getNodeType();
          hash = (hash * 17) + Arrays.hashCode(getNodeAttributes(node));
          if (node.hasAttributes()) {
              NamedNodeMap nodeMap = node.getAttributes();
              for (int i = 0; i < nodeMap.getLength(); ++i) {
                  hash = (31 * hash) + nodeHashCode(nodeMap.item(i));
              }
          }
          if (node.hasChildNodes()) {
              NodeList childNodes = node.getChildNodes();
              for (int i = 0; i < childNodes.getLength(); ++i) {
                  hash = (hash * 47) + nodeHashCode(childNodes.item(i));
              }
          }
          return hash;
      }
docs: hashCode() implementation that is compatible with equals().
  
  @param node
  @return hash code for node