code: protected boolean isEqual(NodeList nodeList1, NodeList nodeList2, XmlCompareMode mode) {
  
      // compare child nodes
      Iterator<Node> nodeIterator1 = new JoiningNodeIterator(nodeList1, mode);
      Iterator<Node> nodeIterator2 = new JoiningNodeIterator(nodeList2, mode);
      while (nodeIterator1.hasNext()) {
        Node child1 = nodeIterator1.next();
        if (!nodeIterator2.hasNext()) {
          return false;
        }
        Node child2 = nodeIterator2.next();
        if ((child1.getNodeType() == Node.DOCUMENT_FRAGMENT_NODE) && (child2.getNodeType() == Node.DOCUMENT_FRAGMENT_NODE)) {
          // according to DOM-spec nodes can never return DocumentFragment as
          // child - in our case this indicates that the JoiningNodeIterator has
          // joined CharacterData according to "mode" into a DocumentFragment.
          CharIterator charIterator1 = new NodeValueCharIterator(child1.getChildNodes());
          CharIterator charIterator2 = new NodeValueCharIterator(child2.getChildNodes());
          if (!isEqual(charIterator1, charIterator2, mode)) {
            return false;
          }
        }
        if (!isEqual(child1, child2, mode)) {
          return false;
        }
      }
      if (nodeIterator2.hasNext()) {
        return false;
      }
      return true;
    }
docs: This method determines if the given {@link NodeList}s are equal.
  
  @param nodeList1 is the first {@link NodeList}.
  @param nodeList2 is the second {@link NodeList}.
  @param mode is the mode of comparison.
  @return {@code true} if equal, {@code false} otherwise.