|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjimm.twice.xml.dom.Node
A document contains a (possibly empty) tree of nodes. Each node knows its parent and children and holds an XML element.
| Field Summary | |
protected java.util.ArrayList |
children
|
protected Element |
element
|
protected int |
indentLevel
|
protected Node |
parent
|
protected static int |
SPACES_PER_INDENT_LEVEL
|
| Constructor Summary | |
Node(Element element)
Constructor. |
|
Node(Element element,
Node parent)
Constructor. |
|
| Method Summary | |
Node |
addChild(Element element)
Given an XML element, creates a node with this element, adds it to the list of children of this node, and returns the new node. |
Node |
addChild(Node node)
Adds node as a child of this node and return it. |
java.util.Iterator |
children()
|
Node |
findStartsWith(java.lang.String prefix)
Performs a depth-first search to find the first node whose element's name starts with prefix. |
Element |
getElement()
|
Node |
getParent()
|
protected byte[] |
indentation()
Returns a byte array containing whitespace that may be used to indent this node's element when creating its XML representation. |
void |
removeAllChildren()
|
void |
removeChild(Node node)
|
void |
setParent(Node p)
|
java.lang.String |
toString()
|
void |
writeTo(java.io.OutputStream out)
Writes this document as XML to the specified OutputStream. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected static final int SPACES_PER_INDENT_LEVEL
protected Element element
protected java.util.ArrayList children
protected Node parent
protected int indentLevel
| Constructor Detail |
public Node(Element element)
null.
element - the XML element
public Node(Element element,
Node parent)
element - the XML elementparent - the parent of this node; ma be null| Method Detail |
public Element getElement()
public java.util.Iterator children()
public void setParent(Node p)
public Node getParent()
public Node addChild(Element element)
element - an XML element
public Node addChild(Node node)
node - a document node
public void removeChild(Node node)
public void removeAllChildren()
public Node findStartsWith(java.lang.String prefix)
null if no such
node is found or if prefix is null or the empty
string.
prefix - the string to search for
null if no such child is
found or prefix is null or the empty stringprotected byte[] indentation()
public void writeTo(java.io.OutputStream out)
throws java.io.IOException
OutputStream.
out - a OutputStream
java.io.IOExceptionpublic java.lang.String toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||