Version Control with XML diff and merge

白昼怎懂夜的黑 提交于 2019-12-09 16:11:43

问题


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!


回答1:


Something I've used in the past is diffxml. You might be able to use this as your diff command for a VCS like svn or git.




回答2:


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.




回答3:


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.




回答4:


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.




回答5:


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.




回答6:


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. Oxygen can merge but it also isn't free.



来源:https://stackoverflow.com/questions/3418344/version-control-with-xml-diff-and-merge

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!