Package de.pdark.decentxml
Class NodeWithChildren
- java.lang.Object
-
- de.pdark.decentxml.NodeWithChildren
-
-
Constructor Summary
Constructors Constructor Description NodeWithChildren()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NodeWithChildren
addNode(int index, Node node)
NodeWithChildren
addNode(Node node)
NodeWithChildren
addNodes(int index, Node... nodes)
NodeWithChildren
addNodes(int index, java.util.Collection<? extends Node> nodes)
NodeWithChildren
addNodes(Node... nodes)
NodeWithChildren
addNodes(java.util.Collection<? extends Node> nodes)
NodeWithChildren
clearNodes()
Remove all nodesNodeWithChildren
copy()
Simulate clone()NodeWithChildren
copy(Node orig)
Copy all data fromorig
intothis
Node
getNode(int index)
Get a specific node from the listjava.util.List<Node>
getNodes()
Get the list of child nodes.<T> java.util.List<T>
getNodes(NodeFilter<T> filter)
boolean
hasNodes()
Does this node have children?int
nodeCount()
The number of nodes in the listint
nodeIndexOf(Node node)
The index of the node in the node list or -1 if it isn't in the listNode
removeNode(int index)
Remove a node from the listboolean
removeNode(Node n)
Remove a node from the listjava.lang.String
toString()
java.lang.String
toXML()
Slow way to convert a node to XMLNodeWithChildren
toXML(XMLWriter writer)
Fast way to convert many nodes to XML-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.pdark.decentxml.Node
createClone, getType
-
-
-
-
Method Detail
-
addNode
public NodeWithChildren addNode(Node node)
-
addNode
public NodeWithChildren addNode(int index, Node node)
-
addNodes
public NodeWithChildren addNodes(java.util.Collection<? extends Node> nodes)
-
addNodes
public NodeWithChildren addNodes(int index, java.util.Collection<? extends Node> nodes)
-
addNodes
public NodeWithChildren addNodes(Node... nodes)
-
addNodes
public NodeWithChildren addNodes(int index, Node... nodes)
-
getNodes
public java.util.List<Node> getNodes()
Description copied from interface:Parent
Get the list of child nodes.CAUTION: Changes to this list will modify the actual data structure! So don't do this unless you know what you're doing!
-
hasNodes
public boolean hasNodes()
Description copied from interface:Parent
Does this node have children?
-
nodeCount
public int nodeCount()
Description copied from interface:Parent
The number of nodes in the list
-
nodeIndexOf
public int nodeIndexOf(Node node)
Description copied from interface:Parent
The index of the node in the node list or -1 if it isn't in the list- Specified by:
nodeIndexOf
in interfaceParent
-
getNode
public Node getNode(int index)
Description copied from interface:Parent
Get a specific node from the list
-
removeNode
public Node removeNode(int index)
Description copied from interface:Parent
Remove a node from the list- Specified by:
removeNode
in interfaceParent
- Returns:
- The removed node.
-
removeNode
public boolean removeNode(Node n)
Description copied from interface:Parent
Remove a node from the list- Specified by:
removeNode
in interfaceParent
- Returns:
- true, if the node is in the list
-
getNodes
public <T> java.util.List<T> getNodes(NodeFilter<T> filter)
-
clearNodes
public NodeWithChildren clearNodes()
Description copied from interface:Parent
Remove all nodes- Specified by:
clearNodes
in interfaceParent
-
toXML
public java.lang.String toXML()
Description copied from interface:Node
Slow way to convert a node to XML
-
toXML
public NodeWithChildren toXML(XMLWriter writer) throws java.io.IOException
Description copied from interface:Node
Fast way to convert many nodes to XML
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
copy
public NodeWithChildren copy(Node orig)
Description copied from interface:Node
Copy all data fromorig
intothis
-
copy
public NodeWithChildren copy()
Description copied from interface:Node
Simulate clone()
-
-