protected SecureSAXParserFactory(SAXParserFactory factory) throws ParserConfigurationException, SAXException {
  this.factory=factory;
  factory.setValidating(false);
  try {
    factory.setXIncludeAware(false);
  }
 catch (  UnsupportedOperationException e) {
  }
catch (  NoSuchMethodError e) {
  }
  try {
    factory.setFeature("http://xml.org/sax/features/external-general-entities",false);
  }
 catch (  IllegalArgumentException e) {
  }
catch (  SAXNotRecognizedException e) {
  }
  try {
    factory.setFeature("http://xml.org/sax/features/external-parameter-entities",false);
  }
 catch (  IllegalArgumentException e) {
  }
catch (  SAXNotRecognizedException e) {
  }
  try {
    factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",false);
  }
 catch (  IllegalArgumentException e) {
  }
catch (  SAXNotRecognizedException e) {
  }
  try {
    factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,true);
  }
 catch (  IllegalArgumentException e) {
  }
catch (  SAXNotRecognizedException e) {
  }
}

protected SecureSAXParserFactory ( SAXParserFactory factory ) throws ParserConfigurationException , SAXException { this . factory = factory ; factory . setValidating ( false ) ; try { factory . setXIncludeAware ( false ) ; } catch ( UnsupportedOperationException e ) { } catch ( NoSuchMethodError e ) { } try { factory . setFeature ( "http://xml.org/sax/features/external-general-entities" , false ) ; } catch ( IllegalArgumentException e ) { } catch ( SAXNotRecognizedException e ) { } try { factory . setFeature ( "http://xml.org/sax/features/external-parameter-entities" , false ) ; } catch ( IllegalArgumentException e ) { } catch ( SAXNotRecognizedException e ) { } try { factory . setFeature ( "http://apache.org/xml/features/nonvalidating/load-external-dtd" , false ) ; } catch ( IllegalArgumentException e ) { } catch ( SAXNotRecognizedException e ) { } try { factory . setFeature ( XMLConstants . FEATURE_SECURE_PROCESSING , true ) ; } catch ( IllegalArgumentException e ) { } catch ( SAXNotRecognizedException e ) { } }
constructs a new securesaxparserfactory instance that delegates most functionality to an existing instance , but overrides where needed to protect against xxe attacks .
