private static SAXParser createSAXParser ( ) throws ParserConfigurationException , SAXException { SAXParserFactory factory = SAXParserFactory . newInstance ( ) ; factory . setValidating ( false ) ; factory . setXIncludeAware ( false ) ; factory . setFeature ( "http://xml.org/sax/features/external-general-entities" , false ) ; factory . setFeature ( "http://xml.org/sax/features/external-parameter-entities" , false ) ; factory . setFeature ( "http://apache.org/xml/features/nonvalidating/load-external-dtd" , false ) ; factory . setFeature ( XMLConstants . FEATURE_SECURE_PROCESSING , true ) ; SAXParser parser = factory . newSAXParser ( ) ; XMLReader xmlReader = parser . getXMLReader ( ) ; xmlReader . setEntityResolver ( NOOP_RESOLVER ) ; return parser ; }
Inlined from guava - internal .