Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.jboss.errai.ui.shared;
 

Author(s):
edewit@redhat.com
Max Barkley <mbarkley@redhat.com>
public class DomVisit {

  
Called to traverse and visit the tree of org.w3c.dom.Elements.

Parameters:
element the root of the tree to traverse and visit
visitor the visitor to be called on each of the nodes.
  public static void visit(Element elementDomVisitor visitor) {
    if (!visitor.visit(element))
      return;
    NodeList childNodes = element.getChildNodes();
    for (int idx = 0; idx < childNodes.getLength(); idx++) {
      Node childNode = childNodes.item(idx);
      if (childNode.getNodeType() == .) {
        visit((ElementchildNodevisitor);
      }
    }
  }
  public static void revisit(Element elementDomRevisitor visitor) {
    if (visitor.visit(element)) {
      NodeList childNodes = element.getChildNodes();
      for (int idx = 0; idx < childNodes.getLength(); idx++) {
        Node childNode = childNodes.item(idx);
        if (childNode.getNodeType() == .) {
          revisit((ElementchildNodevisitor);
        }
      }
    }
    visitor.afterVisit(element);
  }
New to GrepCode? Check out our FAQ X