org.apache.velocity.anakia

Class TreeWalker


public class TreeWalker
extends java.lang.Object

This class allows you to walk a tree of JDOM Element objects. It first walks the tree itself starting at the Element passed into allElements() and stores each node of the tree in a Vector which allElements() returns as a result of its execution. You can then use a #foreach in Velocity to walk over the Vector and visit each Element node. However, you can achieve the same effect by calling element.selectNodes("//*").
Version:
$Id: TreeWalker.java,v 1.6.4.1 2004/03/03 23:22:04 geirm Exp $
Authors:
Jon S. Stevens
Attila Szegedi

Constructor Summary

TreeWalker()
Empty constructor

Method Summary

NodeList
allElements(Element e)
Creates a new Vector and walks the Element tree.
private void
treeWalk(Element e, Collection theElements)
A recursive method to walk the Element tree.

Constructor Details

TreeWalker

public TreeWalker()
Empty constructor

Method Details

allElements

public NodeList allElements(Element e)
Creates a new Vector and walks the Element tree.
Parameters:
Returns:
Vector a vector of Element nodes

treeWalk

private final void treeWalk(Element e,
                            Collection theElements)
A recursive method to walk the Element tree.
Parameters:

Copyright B) 2002 Apache Software Foundation. All Rights Reserved.