views:

87

answers:

6

Hi, I'm looking for an open source version control tool which can diff and merge XML files.

The difficulty I have to find such a tool is, that I need a correct merge of a XML file comparing the nodes and not the lines.

Any idea? Thanks!

A: 

Something I've used in the past is diffxml. The project looks kind of dead, there might be something better maintained. You might be able to use this as your diff command for a VCS like svn or git.

speshak
A: 

Unfortunately, there's no one-size-fits-all solution to this problem. XML diffing is very sensitive to what YOU consider different. In one case the order of child nodes might be important, and in another case (maybe even in the same file) it might be irrelevant.

Take a look at XMLUnit. Even though it's aimed at unit-testing, it is a complete XML differencing engine. You have to tell it (in code) how to determine that two nodes are eligible for comparison, and then what to do with all the potential differences found (i.e. are they real or not, in your application). It detects an exhaustive list of "difference events" including

  • Attribute order
  • Number of attributes
  • Child node order
  • number of child nodes
  • implicit vs explicit attribute values
  • comment differences
  • doctype differences
  • namespace differences

And a whole bunch more. Any of these could be important or unimportant to your application, and only you can decide. It's worth a look, but it will take some work to get what you want.

Jim Garrison
A: 

You're looking for a diff-tool, which is only a subset of what a VCS is. All VCS' can use an external program for diffing files. Since the external diff-tool can be anything, it could also be a script written by you, which is tailored to parse and compare two xml documents.

I don't know if this makes it easier for you to find what you're looking for, but it might.

troelskn
A: 

As others pointed out you just need a good diff tool not the vcs.

Unfortunately I haven't heard about any graphical diff tool that supports xml. So I would use a regular diff tool like (winmerge or k3diff) and then I would validate the xml resulted from merge using any xml validation tool you like.

Piotr Czapla
A: 

Thanks for your answers!

It should be a simple all in one tool for dummy/lazy users. APIs or console programms don't fit. It really looks like that it doesn't exist in the open-source world.

Clearcase can do it but it's to expensive. Oxigen can merge but it also isn't free.

myborobudur
A: 

Project: Merge was designed to solve this exact problem: Comparing and merging XML files through SCM software.

I'm afraid it's not free either, but it's significantly cheaper than other tools that claim to be able to compare and merge XML.

James