code: private boolean bfsComparison(Node root, Node other) {
          if(root instanceof Content || other instanceof Content) {
              return root.equals(other);
          }
          if(! root.equals(other)) {
              return false;
          }
  
          List<Node> a = ((Element)root).getChildElements();
          List<Node> b = ((Element)other).getChildElements();
          if(a.size() != b.size()) {
              return false;
          }
          for(int i=0; i<a.size(); i++) {
              if(! a.get(i).equals(b.get(i))) {
                  return false;
              }
          }
  
          for(int i=0; i<a.size(); i++) {
              if(! bfsComparison(a.get(i), b.get(i))) {
                  return false;
              }
          }
  
          return true;
      }
docs: A strict breadth-first search traversal to evaluate two XML trees against each other
  @param root first tree
  @param other second tree
  @return {@code boolean} true if the trees matches, false otherwise