class XmlUtil {

    private XmlUtil() { }

    /**
     * Constructs a validating secure SAX Parser.
     *
     * @param schemaStream One or more inputStreams with the schema(s) that the
     * parser should be able to validate the XML against, one InputStream per
     * schema
     * @return a SAX Parser
     * @throws javax.xml.parsers.ParserConfigurationException is thrown if there
     * is a parser configuration exception
     * @throws org.xml.sax.SAXNotRecognizedException thrown if there is an
     * unrecognized feature
     * @throws org.xml.sax.SAXNotSupportedException thrown if there is a
     * non-supported feature
     * @throws org.xml.sax.SAXException is thrown if there is a
     * org.xml.sax.SAXException
     */
    public static SAXParser buildSecureSaxParser(InputStream... schemaStream) throws ParserConfigurationException,
            SAXNotRecognizedException, SAXNotSupportedException, SAXException {<FILL_FUNCTION_BODY>}

    /**
     * Constructs a secure SAX Parser.
     *
     * @return a SAX Parser
     * @throws javax.xml.parsers.ParserConfigurationException thrown if there is
     * a parser configuration exception
     * @throws org.xml.sax.SAXNotRecognizedException thrown if there is an
     * unrecognized feature
     * @throws org.xml.sax.SAXNotSupportedException thrown if there is a
     * non-supported feature
     * @throws org.xml.sax.SAXException is thrown if there is a
     * org.xml.sax.SAXException
     */
    public static SAXParser buildSecureSaxParser() throws ParserConfigurationException,
            SAXNotRecognizedException, SAXNotSupportedException, SAXException {
        final SAXParserFactory factory = SAXParserFactory.newInstance();
        factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
        factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
        factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
        return factory.newSAXParser();
    }

    /**
     * Constructs a new document builder with security features enabled.
     *
     * @return a new document builder
     * @throws javax.xml.parsers.ParserConfigurationException thrown if there is
     * a parser configuration exception
     */
    public static DocumentBuilder buildSecureDocumentBuilder() throws ParserConfigurationException {
        final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
        factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
        factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
        return factory.newDocumentBuilder();
    }
}

        final SAXParserFactory factory = SAXParserFactory.newInstance();
        factory.setNamespaceAware(true);
        factory.setValidating(true);
        factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
        factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
        factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
        factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
        factory.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
        factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
        System.setProperty("javax.xml.accessExternalSchema", "file, https");

        final SAXParser saxParser = factory.newSAXParser();
        saxParser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
        saxParser.setProperty(JAXP_SCHEMA_SOURCE, schemaStream);
        return saxParser;
    
<no_super_class>