我試圖在Android上使用的javax.xml.parsers,但我總是得到的ParserConfigurationException試圖設置這兩個功能時:的ParserConfigurationException與Android的javax.xml.parsers
factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
factory.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
這裏是我的代碼
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(false);
factory.setValidating(false);
try {
factory.setFeature("http://xml.org/sax/features/namespaces", false);
factory.setFeature("http://xml.org/sax/features/validation", false);
factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
factory.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
} catch (ParserConfigurationException e) {
e.printStackTrace();
}
是否也能提供堆棧跟蹤,這將是有益的 – ZeusNet