changeset 349:b3eb029e07dd

Added a method that allows to specify if a document needs to be namespace aware while parsing from InputStream. artifacts/trunk@3294 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 21 Nov 2011 11:59:28 +0000
parents f2277458823e
children ab743e750ac6
files ChangeLog artifacts-common/src/main/java/de/intevation/artifacts/common/utils/XMLUtils.java
diffstat 2 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Nov 07 16:40:01 2011 +0000
+++ b/ChangeLog	Mon Nov 21 11:59:28 2011 +0000
@@ -1,3 +1,9 @@
+2011-11-21  Ingo Weinzierl <ingo@intevation.de>
+
+	* artifacts-common/src/main/java/de/intevation/artifacts/common/utils/XMLUtils.java:
+	  Added a method that allows to specify if the document needs to be
+	  namespace aware or not while parsing from InputStream.
+
 2011-11-07  Ingo Weinzierl <ingo@intevation.de>
 
 	* artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java,
--- a/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/XMLUtils.java	Mon Nov 07 16:40:01 2011 +0000
+++ b/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/XMLUtils.java	Mon Nov 21 11:59:28 2011 +0000
@@ -209,9 +209,17 @@
         return null;
     }
 
+
     public static final Document parseDocument(InputStream inputStream) {
+        return parseDocument(inputStream, true);
+    }
+
+    public static final Document parseDocument(InputStream inputStream, Boolean namespaceAware) {
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-        factory.setNamespaceAware(true);
+
+        if (namespaceAware != null) {
+            factory.setNamespaceAware(namespaceAware);
+        }
 
         try {
             return factory.newDocumentBuilder().parse(inputStream);

http://dive4elements.wald.intevation.org