DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18387>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18387 EntityResolver not being called Summary: EntityResolver not being called Product: Xerces2-J Version: 2.3.0 Platform: PC OS/Version: Windows NT/2K Status: NEW Severity: Normal Priority: Other Component: SAX AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] I just upgraded to Tomcat 4.1.24 wich uses xerces 2.3.0. The following code worked before, now my EntityResolver never gets called by the parser and my documents wont parse because xerces cant find the DTD ( which is located in a jar inside a war ). DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating( true ); DocumentBuilder builder = factory.newDocumentBuilder(); InternalErrorHandler errorHandler = new InternalErrorHandler(); builder.setErrorHandler( errorHandler ); builder.setEntityResolver( new InternalEntityResolver() ); //Parse the document Element rootElement = builder.parse( input ).getDocumentElement(); public class InternalEntityResolver implements EntityResolver { public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { InputSource source = null; if( systemId != null ) { //The DTD is contained in my own jar, load it from there InputStream stream = getClass().getClassLoader() .getResourceAsStream( systemId ); if ( stream != null ) { source = new InputSource( stream ); } } return source; } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
