This has the consequence that when using this library and our client code sends an XML request with a DTD in it, MatchIr. fromXmlString which is used by BodyMatching.matchBodies fails to parse the XML properly and we end up with body match failures.
We would like some way of supplying a custom parser or supplying some configuration to toggle that feature, for e.g:
private val XML: XMLLoader[Elem] = createXMLParser(disallowDocType = false)
def createXMLParser(disallowDocType: Boolean = true): XMLLoader[Elem] = {
val sAXParserFactory = SAXParserFactory.newInstance()
sAXParserFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", disallowDocType);
val saxParser = sAXParserFactory.newSAXParser()
xml.XML.withSAXParser(saxParser)
}
What are your thoughts about this feature request? I can try to have a go at at getting this done myself and raise a PR but wanted to run this by you first as per your contributing guidelines state.
The SAX parser created in scala-xml 2.1.0 has the following feature set to true by default:
This has the consequence that when using this library and our client code sends an XML request with a DTD in it,
MatchIr. fromXmlString
which is used byBodyMatching.matchBodies
fails to parse the XML properly and we end up with body match failures.We would like some way of supplying a custom parser or supplying some configuration to toggle that feature, for e.g:
What are your thoughts about this feature request? I can try to have a go at at getting this done myself and raise a PR but wanted to run this by you first as per your contributing guidelines state.