简体   繁体   中英

setFeature(String, boolean) is undefined for the type javax.xml.parsers.DocumentBuilderFactory

DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
builderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
builderFactory.setNamespaceAware(true);`

setNamespaceAware() is working on DocumentBuilderFactory. But compilation error is coming for setFeature().

The method setFeature(String, boolean) is undefined for the type DocumentBuilderFactory

Any suggestions for resolving this.

I would check the classpath first to see where DocumentBuilderFactory comes from. For example, xerces has the javax.xml.parsers.DocumentBuilderFactory class without the setFeature method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM