# HG changeset patch # User Sascha L. Teichmann # Date 1456158321 -3600 # Node ID e781b847fdca562185fc23e5444b25dfbb50dfc1 # Parent df7c3fb4b2761bf3454370f5cd49a37c0cf15c45 Added new File/NS-aware/Entity-Resolver signature for XMLUtils.parseDocument. diff -r df7c3fb4b276 -r e781b847fdca artifacts-common/src/main/java/org/dive4elements/artifacts/common/utils/XMLUtils.java --- 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