You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2003/01/17 19:30:45 UTC
DO NOT REPLY [Bug 12366] -
Cannot use Xerces 2.1.0 with XML configuration file because the file is not referred to as a URL by Log4J.
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=12366>.
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=12366
Cannot use Xerces 2.1.0 with XML configuration file because the file is not referred to as a URL by Log4J.
------- Additional Comments From Andrew.Everitt@gbr.xerox.com 2003-01-17 18:30 -------
This is also a problem with Xerces 2.2.1.
It seems only to happen when the path has spaces in it for me.
There is an alternative which does work with Xerces 2.2.1 which is to use an
Entity resolver.
When setting up the doc builder call:
docbuilder.setEntityResolver(new XMLEntityResolver(DOCTYPE_PUBLICID,
"/path/to/log4j.dtd"));
The XMLEntityResolver class looks like this:
public class XMLEntityResolver implements EntityResolver {
String m_dtdId;
String m_dtdResource;
/**
* Construct a new XMLEntityResolver
* @param id the public Id that this entity resolver will match
* @paramm resource the path to the resource to load the DTD from
*/
public XMLEntityResolver(String id, String resource) {
m_dtdId = id;
m_dtdResource = resource;
}
public InputSource resolveEntity(String publicId, String systemId) throws
SAXException, IOException {
if (publicId == null) {return null; }
if ( publicId.equals(m_dtdId) ) {
InputStream input = this.getClass().getResourceAsStream(m_dtdResource);
InputSource isrc = new InputSource(input);
return isrc;
} else {
return null;
}
}
}
HTH
Andi.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>