# HG changeset patch # User Raimund Renkert # Date 1336397408 0 # Node ID 111d4e28c45ed8ca527c815e9c63da373ecf5438 # Parent fd32dc33a24c8c8e529ef16642427fc170598b45 Added method to create a document from string to XMLUtils. artifacts/trunk@4352 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r fd32dc33a24c -r 111d4e28c45e ChangeLog --- 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 + + * 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 * artifact-database/src/main/java/de/intevation/artifactdatabase/state/State.java, diff -r fd32dc33a24c -r 111d4e28c45e artifacts-common/src/main/java/de/intevation/artifacts/common/utils/XMLUtils.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);