public class TreeNode extends Object
org.w3c.dom need
 not be visible to the remainder of Jasper.
 WARNING - Construction of a new tree, or modifications to an existing one, are not thread-safe and such accesses must be synchronized.
| Modifier and Type | Field and Description | 
|---|---|
| protected HashMap<String,String> | attributesThe attributes of this node, keyed by attribute name,
 Instantiated only if required. | 
| protected String | bodyThe body text associated with this node (if any). | 
| protected ArrayList<TreeNode> | childrenThe children of this node, instantiated only if required. | 
| protected String | nameThe name of this node. | 
| protected TreeNode | parentThe parent node of this node. | 
| Constructor and Description | 
|---|
| TreeNode(String name,
        TreeNode parent)Construct a new node with the specified parent. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addAttribute(String name,
            String value)Add an attribute to this node, replacing any existing attribute
 with the same name. | 
| void | addChild(TreeNode node)Add a new child node to this node. | 
| String | findAttribute(String name)Return the value of the specified node attribute if it exists, or
  nullotherwise. | 
| Iterator<String> | findAttributes()Return an Iterator of the attribute names of this node. | 
| TreeNode | findChild(String name)Return the first child node of this node with the specified name,
 if there is one; otherwise, return  null. | 
| Iterator<TreeNode> | findChildren()Return an Iterator of all children of this node. | 
| Iterator<TreeNode> | findChildren(String name)Return an Iterator over all children of this node that have the
 specified name. | 
| String | getBody()Return the body text associated with this node (if any). | 
| String | getName()Return the name of this node. | 
| void | setBody(String body)Set the body text associated with this node (if any). | 
| String | toString()Return a String representation of this TreeNode. | 
| protected void | toString(StringBuilder sb,
        int indent,
        TreeNode node)Append to the specified StringBuilder a character representation of
 this node, with the specified amount of indentation. | 
protected HashMap<String,String> attributes
protected String body
protected ArrayList<TreeNode> children
protected String name
protected TreeNode parent
public void addAttribute(String name, String value)
name - The attribute name to addvalue - The new attribute valuepublic void addChild(TreeNode node)
node - The new child nodepublic String findAttribute(String name)
null otherwise.name - Name of the requested attributepublic Iterator<String> findAttributes()
public TreeNode findChild(String name)
null.name - Name of the desired child elementpublic Iterator<TreeNode> findChildren()
public Iterator<TreeNode> findChildren(String name)
name - Name used to select childrenpublic String getBody()
public String getName()
public void setBody(String body)
body - The body text (if any)public String toString()
protected void toString(StringBuilder sb, int indent, TreeNode node)
sb - The StringBuilder to append toindent - Number of characters of indentationnode - The TreeNode to be printedCopyright © 2000-2020 Apache Software Foundation. All Rights Reserved.