The EntityResolver set on XMLReader via XMLReader.setEntityResolver(ER) is sometimes called and sometimes not called depending on the format of the URI for the DTD. I am trying to use my entity resolver to load the DTD out of the classpath. However, my Entity Resolver, ER is not always called. The behavior seems to depend on the format of the URI. If the parser thinks it knows how to resolve the URI then it does not call the entity resolver and instead tries to use some default resolver (which cant find the DTD since i'm loading it out of the classpath). For example: These entities will try to use the default resolver <!DOCTYPE Modules SYSTEM "MatchingEngineEngineConfig.dtd"> <!DOCTYPE Modules SYSTEM "justin:MatchingEngineEngineConfig.dtd"> <!DOCTYPE Modules SYSTEM "classpath:MatchingEngineEngineConfig.dtd"> However these entities will use the custom resolver. <!DOCTYPE Modules SYSTEM "file://MatchingEngineEngineConfig.dtd"> I see 1 bug, and one missing feature here: 1) The javadoc for XMLReader.setEntityResolver() needs to be updated to specify this behavior. I would like to know specifically when the custom entity resolver will be called and when it wont. 2) There should be some way to FORCE the parser to use the entity resolver no matter what. This behavior is intimately coupled with using the XMLReader.parse(InputSource) method instead of using the XMLReader.parse(systemID) method. There should be a method: XMLReader.parse(InputSource, EntityResolver) since when you are using an input source you have some reason to avoid the nomral file system mechanisms. (i.e. you have XML and DTDs in a database or an encrypted jar file). ---[ code snippet : getting and configuring the reader ]---------- XMLContentHandler handler = new XMLContentHandler(); XMLReader reader = null; SAXParserFactory factory = javax.xml.parsers.SAXParserFactory.newInstance(); SAXParser parser = factory.newSAXParser(); reader = parser.getXMLReader(); reader.setFeature("http://xml.org/sax/features/validation", true); reader.setContentHandler(handler); reader.setDTDHandler(handler); reader.setEntityResolver(new ClasspathDTDResolver("com/mycorp/mypackage")); reader.setErrorHandler(handler); InputStream xmlInputStream=getClass().getClassLoader().getResourceAsStream(xmlFile); reader.parse(new InputSource(xmlInputStream)); ------------------------