Skip to content

Commit 4b2c3f6

Browse files
author
Ronald Holshausen
committedNov 23, 2019
fix: get XML parser to ignore DTDs #973
1 parent a52115f commit 4b2c3f6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed
 

‎core/matchers/src/main/kotlin/au/com/dius/pact/core/matchers/XmlBodyMatcher.kt

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ object XmlBodyMatcher : BodyMatcher, KLogging() {
4343
val dbFactory = DocumentBuilderFactory.newInstance()
4444
if (System.getProperty("pact.matching.xml.validating") == "false") {
4545
dbFactory.isValidating = false
46+
dbFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false)
47+
dbFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false)
4648
}
4749
val dBuilder = dbFactory.newDocumentBuilder()
4850
val xmlInput = InputSource(StringReader(xmlData))

0 commit comments

Comments
 (0)
Please sign in to comment.