public static SAXParser buildSecureSaxParser ( ) throws ParserConfigurationException , SAXNotRecognizedException , SAXNotSupportedException , SAXException { final SAXParserFactory factory = SAXParserFactory . newInstance ( ) ; factory . setFeature ( "http://apache.org/xml/features/disallow-doctype-decl" , true ) ; factory . setFeature ( "http://xml.org/sax/features/external-general-entities" , false ) ; factory . setFeature ( XMLConstants . FEATURE_SECURE_PROCESSING , true ) ; return factory . newSAXParser ( ) ; }
Constructs a secure SAX Parser .