Mercurial > dive4elements > framework
changeset 387:111d4e28c45e
Added method to create a document from string to XMLUtils.
artifacts/trunk@4352 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Mon, 07 May 2012 13:30:08 +0000 (2012-05-07) |
parents | fd32dc33a24c |
children | 156904aa7c85 |
files | ChangeLog artifacts-common/src/main/java/de/intevation/artifacts/common/utils/XMLUtils.java |
diffstat | 2 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu May 03 07:55:23 2012 +0000 +++ b/ChangeLog Mon May 07 13:30:08 2012 +0000 @@ -1,3 +1,8 @@ +2012-05-07 Raimund Renkert <raimund.renkert@intevation.de> + + * artifacts-common/src/main/java/de/intevation/artifacts/common/utils/XMLUtils.java: + Added method to create a document from string. + 2012-05-03 Ingo Weinzierl <ingo@intevation.de> * artifact-database/src/main/java/de/intevation/artifactdatabase/state/State.java,
--- a/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/XMLUtils.java Thu May 03 07:55:23 2012 +0000 +++ b/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/XMLUtils.java Mon May 07 13:30:08 2012 +0000 @@ -211,6 +211,17 @@ return null; } + /** + * Parses a String to a xml document. + * + * @param string The xml string + * @return the XML document or null if something went wrong. + */ + public static final Document parseDocument(String string) { + InputStream inputStream = new ByteArrayInputStream(string.getBytes()); + return parseDocument(inputStream); + } + public static final Document parseDocument(InputStream inputStream) { return parseDocument(inputStream, Boolean.TRUE);