Questions tagged [xmlunit-2]

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.

69 questions
10
votes
2 answers

Compare XML ignoring element order

With XMLUnit 2 how do you compare two documents without taking the element order into account? I got this question for XMLUnit 1, but apparently the new API in v2 doesn't have the mentioned method anymore. This is my current code: Diff diff =…
Imperative
  • 3,138
  • 2
  • 25
  • 40
5
votes
1 answer

How to ignore XML declaration differences with XmlUnit?

How can I configure XmlUnit.Net to ignore the XML declaration when comparing two documents? Assume I have the following control document: 1 Which I want to compare with:
RMo
  • 132
  • 7
5
votes
1 answer

What is the idiomatic way for printing all the differences in XMLUnit?

I'm trying to override the default XMLUnit behavior of reporting only the first difference found between two inputs with a (text) report that includes all the differences found. I've so far accomplished this: private static void…
Thiago Arrais
  • 33,360
  • 7
  • 30
  • 34
3
votes
1 answer

XML Unit - Using custom element selectors on different xml elements

I'm having a problem comparing various elements in my xml document with XMLUnit (2.2.1). In my document there are several xml elements and I want to know, whether they differ from each other. However, I don't want to compare all xml elements the…
fwshngtn
  • 35
  • 1
  • 7
3
votes
1 answer

Groovy : Compare SOAP Response with XML file

I want to compare in groovy code my Soap Response with xml file ignoring order : Here is my code : import org.custommonkey.xmlunit.Stuff import org.xmlunit.Stuff //ExpectedString is my xml converted to text, same for ResponseString Diff diff =…
Hamza Amami
  • 94
  • 4
  • 21
3
votes
1 answer

Inheriting a C# class that has only a private constructor

I'd like to subclass the XMLUnit.NET CompareConstraint class in my F# code. However, that class only has a single private constructor. If I try to inherit it, I get this compile error: This 'inherit' declaration specifies the inherited type but no…
Eero Helenius
  • 2,584
  • 21
  • 22
2
votes
1 answer

XMLUnit comparing ignoring the order of elements

I have 2 XML. I have been using XMLUnit for comparing the 2 xml strings. The problem is I am not able to ignore the order in which elements occur. I tried overriding ElementQualifier as well as DifferenceListener but that didn't help for this…
Akash Sateesh
  • 271
  • 2
  • 4
  • 13
2
votes
0 answers

XMLUnit to ignore element order

I want XMLUnit to ignore order when comparing. Is there a way to control that? Eg: parameter1 value1 parameter2 value 2 if compared with parameter2 value2 parameter1 value1 should not return any differences. I am using XMLUnit 2 with Java. I…
pas
  • 109
  • 1
  • 13
2
votes
1 answer

Ignoring a particular attribute of a specific Node while comparing xml files using XMLUnit 2.X

I have two XML files: Experts Matrix Reminder
Ish
  • 136
  • 11
2
votes
1 answer

Compare two XML files with child nodes that are not in sequence using xmlunit 2.3.0

I want to compare two XML files in SoapUI (Groovy) which are similar but the child nodes are not in sequence. I'm using XML unit v2.3.0. XML1:
KRS
  • 21
  • 3
2
votes
1 answer

XmlUnit 2.x compare 2 xmls fail because of difference in namespace prefix

Comparing two xmls using XmlUnit 2.2.1 in java. The only difference between the documents is in the namespace prefix. Here is code snippet to reproduce: @Test public void testDifferentPrefix() { final String control = "
Rao
  • 20,781
  • 11
  • 57
  • 77
2
votes
1 answer

Java XPath with XMLUnit 2 and Default Namespace

I had an issue with with writing XPath using XMLUnit 2.0.0 and a default namespace. Here is my sample xml: value I couldn't access any elements with the following XMLUnit XPath code: XPathEngine engine = new…
2
votes
1 answer

XMLUnit 2.0 - Unable to avoid order comparison with custom Element selector

first of all thank you for this wonderful library, it's really great. I'm having a problem comparing elements in different order within my xml document. I've developed a custom ElementSelector to use with the NodeMatcher (later the code) but still…
Kerruba
  • 1,779
  • 1
  • 17
  • 25
1
vote
0 answers

XML comparison with XMLUnit not working in specific scenario where list has different complex element and ordering

I have below XMLs with list of Customers and each Customer has list of transactions. I have managed to write XMLUnit code to ignore the order of Customers but not the transactions. The transactions have bit of unique structure(which cannot be…
Rob Wilkinson
  • 1,131
  • 5
  • 18
  • 34
1
2 3 4 5