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 ?
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 ?
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.
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
.
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).