Mercurial > dive4elements > framework
changeset 549:e781b847fdca 3.2.2
Added new File/NS-aware/Entity-Resolver signature for XMLUtils.parseDocument.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Mon, 22 Feb 2016 17:25:21 +0100 |
parents | df7c3fb4b276 |
children | 68f01f10624e |
files | artifacts-common/src/main/java/org/dive4elements/artifacts/common/utils/XMLUtils.java |
diffstat | 1 files changed, 23 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts-common/src/main/java/org/dive4elements/artifacts/common/utils/XMLUtils.java Mon Dec 28 17:55:00 2015 +0100 +++ b/artifacts-common/src/main/java/org/dive4elements/artifacts/common/utils/XMLUtils.java Mon Feb 22 17:25:21 2016 +0100 @@ -163,7 +163,7 @@ /** * Resolver for entities in artifacts configuration. */ - private static final EntityResolver CONF_RESOLVER = new EntityResolver() { + public static final EntityResolver CONF_RESOLVER = new EntityResolver() { @Override public InputSource resolveEntity( String publicId, @@ -256,6 +256,28 @@ } public static final Document parseDocument( + File file, + Boolean namespaceAware, + EntityResolver entityResolver + ) { + InputStream inputStream = null; + try { + inputStream = new BufferedInputStream(new FileInputStream(file)); + return parseDocument(inputStream, namespaceAware, entityResolver); + } + catch (IOException ioe) { + logger.error(ioe.getLocalizedMessage(), ioe); + } + finally { + if (inputStream != null) { + try { inputStream.close(); } + catch (IOException ioe) {} + } + } + return null; + } + + public static final Document parseDocument( InputStream inputStream, Boolean namespaceAware, EntityResolver entityResolver