These releases fix a few bugs and introduce smaller new features as well as a completely new experimental module that aims to provide a DSL that controls the diff process inside of the control XML document.
Starting with XMLUnit 2.6.0 all XML parsers are configured according to OWASP recommendations for XML eXternal Entity injection preventions - which means you need to override certain settings if you need to load external entities. This is a change that breaks backwards compatibility - at least in the Java version. If you've been using .NET 4.5.2 or above all configurations have been safe by default anyway.
XXE prevention is not enabled inside of the validation package and XMLUnit for Java's legacy module.
The full list of changes for XMLUnit for Java:
- add a new experimental project xmlunit-placeholders which aims to
use
${xmlunit.FOO}
expressions inside of the control document to allow for a DSL-like approach of defining more complex tests. This initial seed only supports${xmlunit.ignore}
which can be used to make XMLUnit ignore the element containing this text. PR #105 by @zheng-wang. - added
withDocumentBuilderFactory
methods toHasXPathMatcher
andEvaluateXPathMatcher
to allow explicit configuration of theDocumentBuilderFactory
used. Issue #108 the
DocmentBuilderFactory
andTransformerFactory
instances used by XMLUnit are now configured to not load any external DTDs or parse external entities. They are now configured according to the OWASP recommendations for XML eXternal Entity injection preventions. TheTransformerFactory
used by theorg.xmlunit.transform.Transformation
class is still configured to load external stylesheets, though.For the
legacy
package XXE prevention has to be enabled viaXMLUnit.enableXXEProtection
explicitly.This is a breaking change and you may need to provide
DocmentBuilderFactory
orTransformerFactory
instances of your own if you need to load external entities.The
SAXParserFactory
andSchemaFactory
instances used inside of thevalidation
package have not been changed as their use is likely to require loading of external DTDs or schemas.Issue #91.
the configured
NodeFilter
is now applied before comparingDocumentType
nodes.This change breaks backwards compatibility as the old behavior was to ignore
DocumentType
when counting the children of theDocument
node but not when actually comparing theDocumentType
. Prior to this change if one document had a document type declaration but the other didn't, aHAS_DOCTYPE_DECLARATION
difference was detected, this will no longer be the case now. If you want to detect this difference, you need to use a more lenientNodeFilter
thanNodeFilters.Default
(i.e.NodeFilters.AcceptAll
) but then you will see an additionalCHILD_NODELIST_LENGTH
difference.The legacy package has been adapted and will behave as before even when using
NewDifferenceEngine
.Issue #116.
- added a new
Source
implementationElementContentWhitespaceStrippedSource
which is similar toWhitespaceStrippedSource
but only affects text nodes that solely consist of whitespace and doesn't affect any other text nodes. Also added convenienceignoreElementContentWhitespace
methods toDiffBuilder
andCompareMatcher
. Issue #119.
The full list of changes for XMLUnit.NET:
- add a new experimental module xmlunit-placeholders which aims to
use
${xmlunit.FOO}
expressions inside of the control document to allow for a DSL-like approach of defining more complex tests. This initial seed only supports${xmlunit.ignore}
which can be used to make XMLUnit ignore the element containing this text. - fixed the message when
CompareConstraint
orValidationConstraints
(both NUnit 2.x and 3.x) as well asEvaluateXPathConstraint
orHasXPathConstraint
(only the NUnit 3.x versions) pass but the assertion fails because the constraint itself was wrapped in aNot
constraint. - the NUnit 3.x
EvaluateXPathConstraint
failed to resolve the nested constraint, leading to erroneous messages if the assertion failed. Issue #25 the
XmlDocument
instances used internally inConvert
andTransformation
now get theirXmlResolver
property set tonull
by default - which happens to be the default value of .NET 4.5.2 and later anyway. This is in accordance with the OWASP recommendations for XML eXternal Entity injection preventions.This may be a breaking change and you may need to provide an explicit
XmlResolver
instance of your own if you need to load external entities.Issue #27.
- added a new
ISource
implementationElementContentWhitespaceStrippedSource
which is similar toWhitespaceStrippedSource
but only affects text nodes that solely consist of whitespace and doesn't affect any other text nodes. Also added convenienceIgnoreElementContentWhitespace
methods toDiffBuilder
andCompareConstraint
. Issue similar to xmlunit/#119. the configured
NodeFilter
is now applied before comparingXmlDocumentType
nodes.This change breaks backwards compatibility as the old behavior was to ignore
XmlDocumentType
when counting the children of theXmlDocument
node but not when actually comparing theXmlDocumentType
. Prior to this change if one document had a document type declaration but the other didn't, aHAS_DOCTYPE_DECLARATION
difference was detected, this will no longer be the case now. If you want to detect this difference, you need to use a more lenientNodeFilter
thanNodeFilters.Default
(i.e.NodeFilters.AcceptAll
) but then you will see an additionalCHILD_NODELIST_LENGTH
difference.Issue #26.
path: /en/oss/XMLUnit | #