code: private static boolean namedNodeMapsAreEqual(final NamedNodeMap a, final NamedNodeMap b) {
          if (a == b) {
              return true;
          }
          if ((a == null) || (b == null)) {
              return false;
          }
          if (a.getLength() != b.getLength()) {
              return false;
          }
  
          List<Node> listA = new ArrayList<Node>(a.getLength());
          List<Node> listB = new ArrayList<Node>(a.getLength());
  
          for (int i = 0; i < a.getLength(); ++i) {
              listA.add(a.item(i));
              listB.add(b.item(i));
          }
  
          Collections.sort(listA, ATTRIBUTE_NODE_COMPARATOR);
          Collections.sort(listB, ATTRIBUTE_NODE_COMPARATOR);
          for (Node n1 : listA) {
              if (!nodesAreEqual(n1, listB.remove(0))) {
                  return false;
              }
          }
          return true;
      }
docs: NamedNodeMaps (e.g. the attributes of a node) are equal if for each containing node an equal
  node exists in the other map.
  
  @param a
  @param b
  @return