1

I have two xmls:

first.xml

<text>This is text</text>
<output>This is output</output>

second.xml

<text>This is not text</text>
<output>This is output</output>

I want to compare these two xmls and output should like this

<text>This is <inserted>not</inserted> text</text>
    <output>This is output</output>

Means, I want to add a new tag suppose <inserted> to newly added text. How to compare these xmls and create new one ?

Thanks for ur time :)

Sachin J
  • 2,081
  • 12
  • 36
  • 50
  • 1
    I would not consider this a duplicate since the original question was 3 1/2 years ago, and the solution ([XMLUnit](http://xmlunit.sourceforge.net/)) hasn't had a release in over 2 years. Also, I would not consider using a unit testing library to solve a programming problem. – Paul Jan 20 '12 at 12:59

2 Answers2

4

Take a look at diffxml.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
3

http://xmlunit.sourceforge.net/

Nice to use in Unit tests, very good output.

  • 1
    Why do you think this question is about testing? This is just the answer of the alleged duplicate, and is a library that hasn't had a release in over 2 years. – Paul Jan 20 '12 at 13:02
  • Because I thought that comparing if two XML files are the same quite like as making a test if two XML files are the same –  Jan 20 '12 at 13:07
  • @Farmor - the body of the question makes it clear that the OP wants the differences between the XML documents ... not just a yes/no answer. – Stephen C Jan 23 '12 at 08:19