Mercurial > dive4elements > framework
comparison artifacts-common/src/main/java/de/intevation/artifacts/common/utils/XMLUtils.java @ 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 | ec5c7e54cae1 |
children | ab743e750ac6 |
comparison
equal
deleted
inserted
replaced
348:f2277458823e | 349:b3eb029e07dd |
---|---|
207 } | 207 } |
208 } | 208 } |
209 return null; | 209 return null; |
210 } | 210 } |
211 | 211 |
212 | |
212 public static final Document parseDocument(InputStream inputStream) { | 213 public static final Document parseDocument(InputStream inputStream) { |
214 return parseDocument(inputStream, true); | |
215 } | |
216 | |
217 public static final Document parseDocument(InputStream inputStream, Boolean namespaceAware) { | |
213 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); | 218 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); |
214 factory.setNamespaceAware(true); | 219 |
220 if (namespaceAware != null) { | |
221 factory.setNamespaceAware(namespaceAware); | |
222 } | |
215 | 223 |
216 try { | 224 try { |
217 return factory.newDocumentBuilder().parse(inputStream); | 225 return factory.newDocumentBuilder().parse(inputStream); |
218 } | 226 } |
219 catch (ParserConfigurationException pce) { | 227 catch (ParserConfigurationException pce) { |