protected SecureDocumentBuilderFactory(DocumentBuilderFactory factory){
  this.factory=factory;
  factory.setValidating(false);
  try {
    factory.setXIncludeAware(false);
  }
 catch (  UnsupportedOperationException e) {
  }
catch (  NoSuchMethodError e) {
  }
  try {
    factory.setAttribute("http://xml.org/sax/features/external-general-entities",false);
  }
 catch (  IllegalArgumentException e) {
  }
  try {
    factory.setAttribute("http://xml.org/sax/features/external-parameter-entities",false);
  }
 catch (  IllegalArgumentException e) {
  }
  try {
    factory.setAttribute("http://apache.org/xml/features/nonvalidating/load-external-dtd",false);
  }
 catch (  IllegalArgumentException e) {
  }
  try {
    factory.setAttribute(XMLConstants.FEATURE_SECURE_PROCESSING,Boolean.TRUE);
  }
 catch (  IllegalArgumentException e) {
  }
}

protected SecureDocumentBuilderFactory ( DocumentBuilderFactory factory ) { this . factory = factory ; factory . setValidating ( false ) ; try { factory . setXIncludeAware ( false ) ; } catch ( UnsupportedOperationException e ) { } catch ( NoSuchMethodError e ) { } try { factory . setAttribute ( "http://xml.org/sax/features/external-general-entities" , false ) ; } catch ( IllegalArgumentException e ) { } try { factory . setAttribute ( "http://xml.org/sax/features/external-parameter-entities" , false ) ; } catch ( IllegalArgumentException e ) { } try { factory . setAttribute ( "http://apache.org/xml/features/nonvalidating/load-external-dtd" , false ) ; } catch ( IllegalArgumentException e ) { } try { factory . setAttribute ( XMLConstants . FEATURE_SECURE_PROCESSING , Boolean . TRUE ) ; } catch ( IllegalArgumentException e ) { } }
constructs a new securedocumentbuilderfactory instance that delegates most functionality to an existing instance , but overrides where needed to protect against xxe attacks .
