class XmlUtils {

    public static DocumentBuilderFactory createDocumentBuilderFactory() {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        try {
            dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
        } catch (ParserConfigurationException e) {
            log.warn("XMLConstants.FEATURE_SECURE_PROCESSING not supported");
        }
        try {
            dbf.setFeature(FEATURE_DISALLOW_DOCTYPE, true);
        } catch (ParserConfigurationException e) {
            log.warn("disallow-doctype-decl not supported");
        }
        try {
            dbf.setFeature(FEATURE_EXTERNAL_GENERAL_ENTITIES, false);
        } catch (ParserConfigurationException e) {
            log.warn("external-general-entities not supported");
        }
        try {
            dbf.setFeature(FEATURE_EXTERNAL_PARAMETER_ENTITIES, false);
        } catch (ParserConfigurationException e) {
            log.warn("external-parameter-entities not supported");
        }
        return dbf;
    }

    private  XmlUtils();

}