public class ConfigXmlTree
extends java.lang.Object
implements java.lang.Cloneable
Constructor and Description |
---|
ConfigXmlTree(java.lang.String elementName)
Construct a node in the tree with no child.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_dump(int indent,
java.io.PrintStream stream)
Print the content of the sub-tree starting from this node to the given
output stream in a text format.
|
protected void |
_setElementName(java.lang.String elementName)
Set the name of this XML element.
|
protected void |
_setParent(ConfigXmlTree parent)
Set the parent of this XML node.
|
void |
addChild(ConfigXmlTree child)
Add a child to this node.
|
java.lang.Object |
clone()
Clone the sub-tree starting from this node, and return the clone result.
|
void |
dump(java.io.PrintStream stream)
Print the content of the sub-tree starting from this node to the given
output stream in a text format.
|
java.lang.String |
getAttribute(java.lang.String name)
Get the value of the attribute with the given name.
|
java.util.Enumeration<java.lang.String> |
getAttributeNames()
Get the names of all the attributes of this XML element.
|
java.lang.String |
getElementName()
Get the name of this XML element.
|
ConfigXmlTree |
getParent()
Get the parent of this node.
|
boolean |
hasAttribute(java.lang.String name)
Test whether this node has an attribute with the given name.
|
boolean |
hasMoreChildren()
Test whether there are more children to traverse.
|
boolean |
isLeaf()
Test whether this node is a leaf in the XML tree.
|
ConfigXmlTree |
nextChild()
Return the next child to be traversed.
|
void |
setAttribute(java.lang.String name,
java.lang.String value)
Set the value of the attribute with the given name.
|
void |
startTraverseChildren()
Start traversing the children of this node by initializing the internal
iterator.
|
public ConfigXmlTree(java.lang.String elementName)
elementName
- The XML element name of the node.public void addChild(ConfigXmlTree child)
child
- The child to be added.public java.lang.Object clone()
clone
in class java.lang.Object
public void dump(java.io.PrintStream stream)
stream
- The stream to be printed to.public java.lang.String getAttribute(java.lang.String name)
name
- The attribute name.setAttribute(String, String)
public java.util.Enumeration<java.lang.String> getAttributeNames()
public java.lang.String getElementName()
public ConfigXmlTree getParent()
public boolean hasAttribute(java.lang.String name)
name
- The attribute name.public boolean hasMoreChildren()
nextChild()
,
startTraverseChildren()
public boolean isLeaf()
public ConfigXmlTree nextChild()
hasMoreChildren()
,
startTraverseChildren()
public void setAttribute(java.lang.String name, java.lang.String value)
name
- The attribute name.value
- The attribute value.getAttribute(String)
public void startTraverseChildren()
hasMoreChildren()
,
nextChild()
protected void _dump(int indent, java.io.PrintStream stream)
indent
- The amount of indentation.stream
- The stream to be printed to.protected void _setElementName(java.lang.String elementName)
elementName
- The element name.protected void _setParent(ConfigXmlTree parent)
addChild(ConfigXmlTree)
of the parent.parent
- The parent node.