@SuppressWarnings("java:S2755")
    public static Document constructDocumentFromXml(final String xmlString) {
        LOGGER.trace("Attempting to construct an instance of Document from xml: [{}]", xmlString);
        try {
            val builder = new SAXBuilder();
            builder.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
            builder.setFeature("http://xml.org/sax/features/external-general-entities", false);
            builder.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
            return builder.build(new ByteArrayInputStream(xmlString.getBytes(Charset.defaultCharset())));
        } catch (final Exception e) {
            LoggingUtils.error(LOGGER, e);
            return null;
        }
    }
Construct document from xml.

@param xmlString the xml string
@return the document
support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/util/AbstractSamlObjectBuilder.java