|
| 1 | +id: documentbuilderfactory-disallow-doctype-decl-false-java |
| 2 | +valid: |
| 3 | + - | |
| 4 | + ParserConfigurationException { |
| 5 | + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); |
| 6 | + dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); |
| 7 | + } |
| 8 | + - | |
| 9 | + ParserConfigurationException { |
| 10 | + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); |
| 11 | + dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); |
| 12 | + dbf.setFeature("http://xml.org/sax/features/external-general-entities", false); |
| 13 | + dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false); |
| 14 | + } |
| 15 | + - | |
| 16 | + ParserConfigurationException { |
| 17 | + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); |
| 18 | + dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); |
| 19 | + dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false); |
| 20 | + dbf.setFeature("http://xml.org/sax/features/external-general-entities", false); |
| 21 | + } |
| 22 | + - | |
| 23 | + ParserConfigurationException { |
| 24 | + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); |
| 25 | + dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); |
| 26 | + dbf.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, ""); |
| 27 | + dbf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, ""); |
| 28 | + } |
| 29 | + - | |
| 30 | + ParserConfigurationException { |
| 31 | + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); |
| 32 | + dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); |
| 33 | + dbf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, ""); |
| 34 | + dbf.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, ""); |
| 35 | + } |
| 36 | + - | |
| 37 | + ParserConfigurationException { |
| 38 | + SAXParserFactory spf = SAXParserFactory.newInstance(); |
| 39 | + spf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); |
| 40 | + } |
| 41 | +invalid: |
| 42 | + - | |
| 43 | + ParserConfigurationException { |
| 44 | + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); |
| 45 | + dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false); |
| 46 | + } |
| 47 | + - | |
| 48 | + ParserConfigurationException { |
| 49 | + SAXParserFactory spf = SAXParserFactory.newInstance(); |
| 50 | + spf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false); |
| 51 | + } |
0 commit comments