private static void secureProcessing(final SAXParserFactory factory) {
        try {
            factory.setFeature(
                    XMLConstants.FEATURE_SECURE_PROCESSING,
                    SAXParserSettings.isSecureProcessingEnabled());


//            System.setProperty(XalanConstants.SP_TOTAL_ENTITY_SIZE_LIMIT, "50000010");
//
//            //
//            // Implementation limits: corresponding System Properties of the above
//            // API properties
//            //
//            /**
//             * JDK entity expansion limit; Note that the existing system property
//             * "entityExpansionLimit" with no prefix is still observed
//             */
//            public static final String SP_ENTITY_EXPANSION_LIMIT = "jdk.xml.entityExpansionLimit";
//
//            /**
//             * JDK element attribute limit; Note that the existing system property
//             * "elementAttributeLimit" with no prefix is still observed
//             */
//            public static final String SP_ELEMENT_ATTRIBUTE_LIMIT =  "jdk.xml.elementAttributeLimit";
//
//            /**
//             * JDK maxOccur limit; Note that the existing system property
//             * "maxOccurLimit" with no prefix is still observed
//             */
//            public static final String SP_MAX_OCCUR_LIMIT = "jdk.xml.maxOccurLimit";
//
//            /**
//             * JDK total entity size limit
//             */
//            public static final String SP_TOTAL_ENTITY_SIZE_LIMIT = "jdk.xml.totalEntitySizeLimit";
//
//            /**
//             * JDK maximum general entity size limit
//             */
//            public static final String SP_GENERAL_ENTITY_SIZE_LIMIT = "jdk.xml.maxGeneralEntitySizeLimit";
//
//            /**
//             * JDK node count limit in entities that limits the total number of nodes
//             * in all of entity references.
//             */
//            public static final String SP_ENTITY_REPLACEMENT_LIMIT = "jdk.xml.entityReplacementLimit";
//
//            /**
//             * JDK maximum parameter entity size limit
//             */
//            public static final String SP_PARAMETER_ENTITY_SIZE_LIMIT = "jdk.xml.maxParameterEntitySizeLimit";
//            /**
//             * JDK maximum XML name limit
//             */
//            public static final String SP_XML_NAME_LIMIT = "jdk.xml.maxXMLNameLimit";
//
//            /**
//             * JDK maxElementDepth limit
//             */
//            public static final String SP_MAX_ELEMENT_DEPTH = "jdk.xml.maxElementDepth";


        } catch (final ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
            LOGGER.error(e.getMessage(), e);
        }
    }
Our own factory class to return the desired SAXParserFactory implementation. This is due to the many xerces
implementations available, e.g. the internal one in the JDK, and the one bundled in gwt-dev. This class reports the
value of the javax.xml.parsers.SAXParserFactory property which is used by SAXParserFactory to determine which
implementation to return. If the property is not set then we hard code it to the xerces implementation in the JRE.
stroom-util/src/main/java/stroom/util/xml/SAXParserFactoryFactory.java