Mercurial > dive4elements > framework
diff artifacts-common/src/main/java/de/intevation/artifacts/common/utils/XMLUtils.java @ 338:ec5c7e54cae1
Cosmetics (and fix for XMLUtils.toString(Element)).
artifacts/trunk@2913 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 10 Oct 2011 07:37:06 +0000 |
parents | 2c968defd878 |
children | b3eb029e07dd |
line wrap: on
line diff
--- a/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/XMLUtils.java Fri Oct 07 15:32:58 2011 +0000 +++ b/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/XMLUtils.java Mon Oct 10 07:37:06 2011 +0000 @@ -60,15 +60,13 @@ */ public final class XMLUtils { - /** - * W3C URL of XForms - */ + /** W3C URL of XForms. */ public static final String XFORM_URL = "http://www.w3.org/2002/xforms"; - /** - * W3C prefix of XForms - */ + + /** W3C prefix of XForms. */ public static final String XFORM_PREFIX = "xform"; + /** Logger for this class. */ private static Logger logger = Logger.getLogger(XMLUtils.class); private XMLUtils() { @@ -80,17 +78,13 @@ */ public static class ElementCreator { - /** - * owner document of the elements to be created - */ + /** Owner document of the elements to be created. */ protected Document document; - /** - * namespace to be used - */ + + /** Namespace to be used. */ protected String ns; - /** - * prefix to be used - */ + + /** Prefix to be used. */ protected String prefix; /** @@ -184,27 +178,14 @@ * @param element element to inspect in string. * @return string with xml representation of element. */ - public final static String toString(Element element) { + public final static String toString(Node node) { Document doc = newDocument(); - doc.appendChild(doc.importNode(element,true)); + doc.appendChild(doc.importNode(node,true)); return toString(doc); } /** - * Creates xml/string representation of node (nested in otherwise empty - * document). - * @param element element to inspect in string. - * @return string with xml representation of element. - */ - public final static String toString(Node node) { - Document doc = newDocument(); - doc.importNode(node, true); - return toString(doc); - } - - - /** * Loads a XML document namespace aware from a file * @param file The file to load. * @return the XML document or null if something went wrong