class IgnoreDTDEntityResolver implements EntityResolver
{
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
return new InputSource(new ByteArrayInputStream(
"<?xml version='1.0' encoding='UTF-8'?>".getBytes()));
}
}
SAXReader saxReader = new SAXReader();
saxReader.setValidation(false);
try {
saxReader.setEntityResolver(new IgnoreDTDEntityResolver());
document = saxReader.read(file);
} catch (DocumentException e) {
e.printStackTrace();
}