DTD download error while parsing XHTML document in XOM

后端 未结 2 1366
醉梦人生
醉梦人生 2020-12-17 02:25

I am trying to parse an HTML document with the doctype declared to use the transitional dtd as follows:

2条回答
  •  再見小時候
    2020-12-17 02:48

    This solves the problem:

    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                factory.setValidating(false);
                factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
                Document document = factory.newDocumentBuilder().parse(is);
    

提交回复
热议问题