* tree pretty fast.
*
* <pre>
+ *
* SimpleXML deepNode = topNode.getNodes(new String[] { "person", "address", "number" });
* </pre>
*
*/
public SimpleXML getNode(String[] nodeNames) {
SimpleXML node = this;
- for (String nodeName: nodeNames) {
+ for (String nodeName : nodeNames) {
node = node.getNode(nodeName);
}
return node;
*/
public SimpleXML[] getNodes(String nodeName) {
List<SimpleXML> resultList = new ArrayList<SimpleXML>();
- for (SimpleXML child: children) {
+ for (SimpleXML child : children) {
if ((nodeName == null) || child.name.equals(nodeName)) {
resultList.add(child);
}
* With this method you can create deep structures very fast.
*
* <pre>
+ *
* SimpleXML mouseNode = topNode.append("computer").append("bus").append("usb").append("mouse");
* </pre>
*
* The element to attach this node's children to
*/
private void addChildren(Element rootElement) {
- for (SimpleXML child: children) {
+ for (SimpleXML child : children) {
Element childElement = rootElement.getOwnerDocument().createElement(child.name);
rootElement.appendChild(childElement);
if (child.value != null) {