1 package org.apache.velocity.anakia; 2 3 18 19 import java.util.ArrayList ; 20 import java.util.Collection ; 21 import java.util.Iterator ; 22 23 import org.jdom.Element; 24 25 38 public class TreeWalker 39 { 40 43 public TreeWalker() 44 { 45 } 47 48 54 public NodeList allElements(Element e) 55 { 56 ArrayList theElements = new ArrayList (); 57 treeWalk (e, theElements); 58 return new NodeList(theElements, false); 59 } 60 61 65 private final void treeWalk(Element e, Collection theElements ) 66 { 67 for (Iterator i=e.getChildren().iterator(); i.hasNext(); ) 68 { 69 Element child = (Element)i.next(); 70 theElements.add(child); 71 treeWalk(child, theElements); 72 } 73 } 74 } 75 | Popular Tags |