code: public void visit(boolean depthFirst, Consumer<? super XElement> action) {
          Deque<XElement> queue = new LinkedList<>();
          queue.add(this);
          while (!queue.isEmpty()) {
              XElement x = queue.removeFirst();
              action.accept(x);
              if (depthFirst) {
                  ListIterator<XElement> li = x.children.listIterator(x.children.size());
                  while (li.hasPrevious()) {
                      queue.addFirst(li.previous());
                  }
              } else {
                  for (XElement c : x.children) {
                      queue.addLast(c);
                  }
              }
          }
      }
docs: Iterate through the elements of this XElement and invoke the action for each.
  @param depthFirst do a depth first search?
  @param action the action to invoke, non-null