Questions tagged [xmlunit]

XMLUnit is an open source project which enables JUnit-style assertions to be made about the content and structure of XML.

XMLUnit extends and to enable unit testing of XML.

It compares a control XML document to a test document or the result of a transformation, validates documents, and compares the results of expressions.

XMLUnit for Java

XMLUnit for Java provides two JUnit extension classes, XMLAssert and XMLTestCase, and a set of supporting classes (e.g. Diff, DetailedDiff,Transform,SimpleXpathEngine,Validator,NodeTest) that allow assertions to be made about:

  • The differences between two pieces of XML
  • The outcome of transforming a piece of XML using XSLT
  • The evaluation of an XPath expression on a piece of XML
  • The validity of a piece of XML
  • Individual nodes in a piece of XML that are exposed by DOM Traversal

XMLUnit for Java can also treat HTML content (even badly-formed HTML) as valid XML to allow these assertions to be made about the content of web pages too.

XMLUnit is available for and .

184 questions
0
votes
4 answers

Comparing Two XMLs

I have a case in my Java EE application like I need to compare two large auto-generated XMLs. I just need to check if both the XMLs are equal (tags and values). I tried using XMLUnit, but the thing is like it returns false even if there are spaces…
Bash
  • 21
  • 3
  • 8
0
votes
0 answers

In xmlunit, can the Diff.identical() return TRUE for (xml1,xml2) pair and FALSE for (xml2,xml1)?

I'm using the xmlunit framework (i think version 1.0, or at least that's what the manifest of the .jar says). What i'm doing is this: Diff diff=new Diff(xml1,xml2); diff.overrideElementQualifier(new…
vlad-ardelean
  • 7,480
  • 15
  • 80
  • 124
-1
votes
1 answer

Output of Java XML comparison tool

I wrote a short Java Tool for XML comparison using XMLunit. For my purposes it’s necessary to ignore the node order and some special element names. The attached code is working fine for that. Now I would like to get the differences. Unfortunately …
Michael Konz
  • 170
  • 15
-1
votes
2 answers

compare 2 xmls with different tags in java

I wanted to compare 2 XMLs, which have the same data but the tag names are different. I need to compare two (input and output) and show the result using JAVA. eg. XML 1 newyork ... XML 2 newyork I need to verify…
Piyush
  • 372
  • 3
  • 8
  • 19
1 2 3
12
13