dom4j dtd验证出错

错误:

Exception in thread "main" org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection timed out: connect
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.dom4j.io.SAXReader.read(SAXReader.java:321)
at ValidationTest.validate(ValidationTest.java:68)
at ValidationTest.main(ValidationTest.java:45)

解决方法:
SAXReader reader = new SAXReader();
reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);

...

你可能感兴趣的:(dom4j)