an open source project which enables JUnit-style assertions to be made about the content and structure of XML. XMLUnit 2.x is a complete rewrite and is based on the experience of XMLUnit 1.x.
Questions tagged [xmlunit-2]
69 questions
0
votes
1 answer
Compare XML using xmlunit when order of Attributes is different is not working
I have 2 xmls : Basically two XSD schemas

Abhi
- 309
- 1
- 10
0
votes
0 answers
Example for ComparisonFormatter
It would be great if someone can guide me on using ComparisonFormatter in XMLUnit 2.x.
String controlXml = "\n" +
" foo\n" +
" bar\n" +
" ";
String testXml = "\n" +
" foo\n"…

Varshaa
- 1
- 1
0
votes
2 answers
Is there any way to compare two xml and it should ignore exact content text but it should compare content text by Data type
I have tried the below example and tried with different methods of DiffBuilder and CompareMatcher classes:
import org.junit.jupiter.api.Test;
import org.xmlunit.diff.DefaultNodeMatcher;
import org.xmlunit.diff.ElementSelectors;
import…

KB1
- 51
- 5
0
votes
1 answer
When comparing XML files, how to get detailed response using XMLUnit 2.8.2
I need help with ComparisonFormatter. I've not been able to find many examples on ComparisonFormatter online.
I'm using XMLUnit 2.8.2.
I'm trying to compare two xml files regardless of their order. The code below works fine when responses are in…

zara
- 99
- 1
- 8
0
votes
1 answer
how to compare prefixed with no prefix xml documents in xmlunit to get similar result
xmlnit does not recognize the following two xml "identical" (except one has defined namespace) documents to be similar:
…

ama
- 1,525
- 1
- 16
- 34
0
votes
0 answers
XMLUnit-2 is failing with `withNodeMatcher` API for random order of List
I've used below DiffBuilder using XMLUnit-2
diff = DiffBuilder.compare(control).withTest(test).checkForSimilar()
.normalizeWhitespace().ignoreComments()
.ignoreWhitespace().ignoreElementContentWhitespace()
.withNodeFilter(node -> (filter(node,…

Swapnil Kotwal
- 5,418
- 6
- 48
- 92
0
votes
2 answers
XMLUnit - compare xml and ignore few tags based on a condition
I have couple of xmls which needs to be compared with different set of similar xml and while comparing i need to ignore tags based on a condition, for example
personal.xml - ignore fullname
address.xml - igone zipcode
contact.xml - ignore…

achyuth pydmarri
- 31
- 3
0
votes
1 answer
XMLUnit-2.0 xpath doesn't ignoring the XML node order
I've a XML as below

Swapnil Kotwal
- 5,418
- 6
- 48
- 92
0
votes
1 answer
XMLUnit-2 ignore certain nested XML elements
My XML is little complex and I've to ignore certain entry from the comparison, how would I able to achieve it ?

Swapnil Kotwal
- 5,418
- 6
- 48
- 92
0
votes
1 answer
XMLUnit-2 compare partial XMLs
I have a local test XML data as below
testLocalXML
something different
something else
yet another thing
but the data I'm getting from server could be large and will…

Swapnil Kotwal
- 5,418
- 6
- 48
- 92
0
votes
0 answers
XMLUnitException - Caught exception during comparison
Caught exception during comparison] Exception[org.xmlunit.XMLUnitException] follows: org.xmlunit.XMLUnitException: Caught exception during comparison at org.xmlunit.diff.DOMDifferenceEngine.compare(DOMDifferenceEngine.java:88) at…

Ben
- 195
- 2
- 10
0
votes
1 answer
How to ignore nodes with It values when comparing two xmls with XMLUnit2
Comparing two xml files in soapui using groovy with XMLUnit2, Have some weird cases which are different in both files, but are acceptable. So have to ignore/skip those.
ResXML1:
Generic…

Reddy
- 23
- 3
0
votes
1 answer
How to print all differences when comparing two xml files using XMLUnit2
Using XMLUnit2 to compare two xml files using groovy in soapui, it's comparing two files successfully.Would like to print all differences what it finds, but it just printing only first difference. XMLUnit1 supposes to print all differences, but…

Reddy
- 23
- 3
0
votes
0 answers
How to implement the .withAttributeFilter in XMLUnit2.0 DiffBuilder?
I want my Java program to ignore few attributes while comparing 2 XMLs. I do not want to use the Node Filter as it would ignore the child elements as well from comparison. I tried different implementations for the attribute filter, but nothing…

pavithra .s
- 1
- 1
0
votes
1 answer
How can I compare map-like elements with XMLUnit
I have below xml data:
Control:
Name1
Value1
…

anuni
- 889
- 10
- 26