core/src/main/java/com/opentext/ia/sdk/support/xml/XmlUtil.java
public static DocumentBuilderFactory newSecureDocumentBuilderFactory() {
    try {
      DocumentBuilderFactory result = DocumentBuilderFactory.newInstance();
      result.setFeature("http://javax.xml.XMLConstants/feature/secure-processing", true);
      result.setFeature("http://xml.org/sax/features/external-general-entities", false);
      result.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
      result.setNamespaceAware(true);
      result.setValidating(true);
      return result;
    } catch (ParserConfigurationException e) {
      throw new IllegalStateException(e);
    }
  }
public static DocumentBuilderFactory newSecureDocumentBuilderFactory() {
    try {
      DocumentBuilderFactory result = DocumentBuilderFactory.newInstance();
      result.setFeature("http://javax.xml.XMLConstants/feature/secure-processing", true);
      result.setFeature("http://xml.org/sax/features/external-general-entities", false);
      result.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
      result.setNamespaceAware(true);
      result.setValidating(true);
      return result;
    } catch (ParserConfigurationException e) {
      throw new IllegalStateException(e);
    }
  }
public static DocumentBuilderFactory newSecureDocumentBuilderFactory ( ) { try { DocumentBuilderFactory result = DocumentBuilderFactory . newInstance ( ) ; result . setFeature ( "http://javax.xml.XMLConstants/feature/secure-processing" , true ) ; result . setFeature ( "http://xml.org/sax/features/external-general-entities" , false ) ; result . setFeature ( "http://xml.org/sax/features/external-parameter-entities" , false ) ; result . setNamespaceAware ( true ) ; result . setValidating ( true ) ; return result ; } catch ( ParserConfigurationException e ) { throw new IllegalStateException ( e ) ; } }
Return a new factory for building XML documents that is configured to operate securely. The factory also supports
<a href="http://www.w3.org/TR/REC-xml-names/">XML namespaces</a> and validation.
@return The newly created factory
Return a new factory for building XML documents that is configured to operate securely . The factory also supports <a href = http : // www . w3 . org / TR / REC - xml - names / > XML namespaces< / a > and validation .