when i am trying to parse an xml, i am getting following exception :-
java.net.UnknownHostException: hibernate.sourceforge.net
at java.net.AbstractPlainS
i used the following code and this is working fine for me..
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(false);
DocumentBuilder db = dbf.newDocumentBuilder();
db.setEntityResolver(new EntityResolver() {
@Override
public InputSource resolveEntity(String arg0, String arg1)
throws SAXException, IOException {
if(arg0.contains("Hibernate")) {
return new InputSource(new StringReader(""));
} else {
// TODO Auto-generated method stub
return null;
}
}
});
Document doc = db.parse(hbmFile);