0

I want to compare two xml files with the same structure. I want to know exactly what are difference in each nodes.

What is the best way to do this ?

  • Do you always have the same elements/objects in your files and only their parametervalues change or does the whole thing change? – Master117 Jun 11 '16 at 14:13
  • Yes always the same element but not always the same count. Element repeated etc –  Jun 11 '16 at 14:35
  • 1
    Does this help: http://stackoverflow.com/questions/4590214/comparing-two-xml-files-generating-a-third-with-xmldiff-in-c-sharp – kjhughes Jun 11 '16 at 18:53

3 Answers3

0

There is no silver bullet for this type question, it depends on the structure and size of your xml file. If it is short and with fewer properties and attribute, and diff/merge tool is OK for this task. If it is in a complex structure, you need write program to parse and compare it.

gzh
  • 3,507
  • 2
  • 19
  • 23
0

Like @gzh said, there is no silver bullet.

You could try Oxygen XML Diff Files program, it comes with OxygenXML Developer. (I am not affiliated with Oxygen XML). I believe other XML tools have similar functionality.

Or, you could try XSLT. But there is a significant learning curve with XSLT.

StepUp
  • 36,391
  • 15
  • 88
  • 148
0

Usually, I prefer a text-based comparison, so I run a formatter on both XML files and compare them using a tool like Eclipse or Winmerge.

The Eclipse formatter seems to work fine with XML files (but not with HTML or JSF files). Alternatively, the "pretty print" plugin of Notepad++ does a good job formatting the files (see this StackOverflow question).

Community
  • 1
  • 1
Stephan Rauh
  • 3,069
  • 2
  • 18
  • 37