private static class DTDResolver implements EntityResolver {
public InputSource resolveEntity(String publicId, String systemId) {
String uri = null;
if (systemId.startsWith("http:")) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
return new InputSource(cl.getResource("xhtml" + systemId.substring(systemId.lastIndexOf('/'))).getFile());
} else if (systemId.startsWith("file:")) {
uri = systemId;
return new InputSource(uri);
}
return null;
}