public void enableDTD(boolean enable) {
        //允许DTD会有XXE漏洞，关于XXE漏洞：https://www.owasp.org/index.php/XML_External_Entity_(XXE)_Prevention_Cheat_Sheet
        if (enable) {
            //不允许DTD
            setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
            setFeature("http://xml.org/sax/features/external-general-entities", false);
            setFeature("http://xml.org/sax/features/external-parameter-entities", false);
        } else {
            setFeature("http://apache.org/xml/features/disallow-doctype-decl", false);
            setFeature("http://xml.org/sax/features/external-general-entities", true);
            setFeature("http://xml.org/sax/features/external-parameter-entities", true);
        }
    }
public void enableDTD ( boolean enable ) { if ( enable ) { setFeature ( "http://apache.org/xml/features/disallow-doctype-decl" , true ) ; setFeature ( "http://xml.org/sax/features/external-general-entities" , false ) ; setFeature ( "http://xml.org/sax/features/external-parameter-entities" , false ) ; } else { setFeature ( "http://apache.org/xml/features/disallow-doctype-decl" , false ) ; setFeature ( "http://xml.org/sax/features/external-general-entities" , true ) ; setFeature ( "http://xml.org/sax/features/external-parameter-entities" , true ) ; } }
设置DTD支持

@param enable true表示支持DTD，false表示不支持