You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2003/03/26 21:28:09 UTC
DO NOT REPLY [Bug 18387] New: -
EntityResolver not being called
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: xerces-j-dev@xml.apache.org
ReportedBy: sean.scott@mdx.com
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: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org