/** Accessor method for chaining entity resolver implementation. */ private static synchronized XMLEntityResolverChain getChainingEntityResolver() { if (chainingEntityResolver == null) { chainingEntityResolver = new XMLEntityResolverChain(); chainingEntityResolver.addEntityResolver(getSystemResolver()); } return chainingEntityResolver; }
/** Parses the primary file of this data object. * and provide different implementation. * * @return the document in the primary file * @exception IOException if error during parsing occures */ final Document parsePrimaryFile () throws IOException, SAXException { emgr().log ("parsePrimaryFile"); String loc = getPrimaryFile().getURL().toExternalForm(); try { return XMLUtil.parse(new InputSource(loc), false, /* #36295 */true, errorHandler, getSystemResolver()); } catch (IOException e) { // Perhaps this document was not on a mounted filesystem. // Try again with an input stream - no relative URLs will work, but this // is extremely unlikely to matter. Cf. #36340. InputStream is = getPrimaryFile().getInputStream(); try { return XMLUtil.parse(new InputSource(is), false, true, errorHandler, getSystemResolver()); } finally { is.close(); } } }