[
https://issues.apache.org/jira/browse/XMLBEANS-569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17411807#comment-17411807
]
PJ Fanning commented on XMLBEANS-569:
-------------------------------------
An existing way to achieve this is:
final String FEATURE_LOAD_DTD_GRAMMAR =
"[http://apache.org/xml/features/nonvalidating/load-dtd-grammar]";
final String FEATURE_LOAD_EXTERNAL_DTD =
"[http://apache.org/xml/features/nonvalidating/load-external-dtd]";
final String FEATURE_DISALLOW_DOCTYPE_DECL =
"[http://apache.org/xml/features/disallow-doctype-decl]";
SAXParserFactory saxFactory = SAXParserFactory.newInstance();
saxFactory.setValidating(false);
saxFactory.setNamespaceAware(true);
saxFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
saxFactory.setFeature(FEATURE_LOAD_DTD_GRAMMAR, false);
saxFactory.setFeature(FEATURE_LOAD_EXTERNAL_DTD, false);
saxFactory.setFeature(FEATURE_DISALLOW_DOCTYPE_DECL, true);
XMLReader xmlReader = saxFactory.newSAXParser().getXMLReader();
options.setLoadUseXMLReader(xmlReader);
> support disallow-doctype-decl setting on XML parser
> ---------------------------------------------------
>
> Key: XMLBEANS-569
> URL: https://issues.apache.org/jira/browse/XMLBEANS-569
> Project: XMLBeans
> Issue Type: New Feature
> Components: DOM
> Affects Versions: Version 5.0.1
> Reporter: PJ Fanning
> Assignee: PJ Fanning
> Priority: Major
> Fix For: Version 5.0.2
>
>
> https://xerces.apache.org/xerces2-j/features.html#disallow-doctype-decl
> XmlOptions will support this:
> options.setDisallowDocTypeDeclaration(true);
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]