Java: How to prevent 'systemId' in EntityResolver#resolveEntity(String publicId, String systemId) from being absolutized to current working directory
问题 I want to parse the following XML document to resolve all entities in it: <!DOCTYPE doc SYSTEM 'mydoc.dtd'> <doc>&title;</doc> My EntityResolver is supposed to fetch the external entity with the given system ID from the database and then do the resolution, see below for an illustration: private static class MyEntityResolver { public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { // At this point, systemId is always absolutized to the current