X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fde%2Ftodesbaum%2Futil%2Fxml%2FSimpleXML.java;h=83515816d5c7f5906133b9bd6f5362a0a89c09b0;hb=953de352675a4ad91fe307d816a4ea7780c94274;hp=ae0a4871bfa3bc1611602810b9f6f13142fe4161;hpb=b91ef6c88d0b375f956fd9f8436d1453b8ae7aa2;p=jSite.git diff --git a/src/de/todesbaum/util/xml/SimpleXML.java b/src/de/todesbaum/util/xml/SimpleXML.java index ae0a487..8351581 100644 --- a/src/de/todesbaum/util/xml/SimpleXML.java +++ b/src/de/todesbaum/util/xml/SimpleXML.java @@ -1,4 +1,6 @@ /* + * jSite - SimpleXML.java - Copyright © 2006–2012 David Roden + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -98,6 +100,7 @@ public class SimpleXML { * tree pretty fast. * *
+	 *
 	 * SimpleXML deepNode = topNode.getNodes(new String[] { "person", "address", "number" });
 	 * 
* @@ -107,7 +110,7 @@ public class SimpleXML { */ public SimpleXML getNode(String[] nodeNames) { SimpleXML node = this; - for (String nodeName: nodeNames) { + for (String nodeName : nodeNames) { node = node.getNode(nodeName); } return node; @@ -133,7 +136,7 @@ public class SimpleXML { */ public SimpleXML[] getNodes(String nodeName) { List resultList = new ArrayList(); - for (SimpleXML child: children) { + for (SimpleXML child : children) { if ((nodeName == null) || child.name.equals(nodeName)) { resultList.add(child); } @@ -146,6 +149,7 @@ public class SimpleXML { * With this method you can create deep structures very fast. * *
+	 *
 	 * SimpleXML mouseNode = topNode.append("computer").append("bus").append("usb").append("mouse");
 	 * 
* @@ -279,7 +283,7 @@ public class SimpleXML { * 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) { @@ -319,7 +323,7 @@ public class SimpleXML { NodeList childNodes = document.getChildNodes(); for (int childIndex = 0, childCount = childNodes.getLength(); childIndex < childCount; childIndex++) { Node childNode = childNodes.item(childIndex); - if ((childNode.getChildNodes().getLength() == 1) && (childNode.getFirstChild().getNodeName().equals("#text")) /*&& (childNode.getFirstChild().getNodeValue().trim().length() != 0)*/) { + if ((childNode.getChildNodes().getLength() == 1) && (childNode.getFirstChild().getNodeName().equals("#text"))) { xmlDocument.append(childNode.getNodeName(), childNode.getFirstChild().getNodeValue()); } else { if (!childNode.getNodeName().equals("#text") || (childNode.getChildNodes().getLength() != 0)) {