@@ -0,0 +1,1149 @@
+package experimentalcode.erich;%0A%0Aimport java.util.Iterator;%0A%0Aimport org.w3c.dom.Node;%0A%0A/**%0A * Simple adapter class to iterate over a DOM tree nodes children.%0A * %0A * @author Erich Schubert%0A *%0A */%0Apublic final class XMLNodeIterator implements Iterable%3CNode%3E, Iterator%3CNode%3E %7B%0A  /**%0A   * Store the next node%0A   */%0A  private Node next;%0A%0A  /**%0A   * Constructor with first element to iterate over.%0A   * %0A   * @param first first child of parent node.%0A   */%0A  public XMLNodeIterator(Node first) %7B%0A    super();%0A    this.next = first;%0A  %7D%0A%0A  /**%0A   * Check if the next node is defined. %0A   */%0A  @Override%0A  public boolean hasNext() %7B%0A    return (next != null);%0A  %7D%0A%0A  /**%0A   * Return next and advance iterator.%0A   */%0A  @Override%0A  public Node next() %7B%0A    Node cur = next;%0A    next = next.getNextSibling();%0A    return cur;%0A  %7D%0A%0A  /**%0A   * Removal: unsupported operation.%0A   */%0A  @Override%0A  public void remove() %7B%0A    throw new UnsupportedOperationException(%22XMLNodeIterator doesn't support remove%22);%0A  %7D%0A%0A  /**%0A   * Iterable interface adapter - clone.%0A   */%0A  @Override%0A  public Iterator%3CNode%3E iterator() %7B%0A    return new XMLNodeIterator(this.next);%0A  %7D  %0A%7D%0A

Simplify XML handling by using DOM instead of Pull API.