I have two XML files. They are similar, but there are two nodes of which either of the file have only one. I want to merge two sets of such documents in one single document where first the node of side A is taken, followed by the nodes of side B.
I’m not an experienced user of diff tools and downloaded KDiff3 to start somewhere.. Can anybody put me on the right path?
–EDIT–
Finding diff tools is something I can manage on my own.
But how to make one of these tools (doesn’t matter which one) make the merging go automatically by first putting in the part from file1 and then from file2 is what I’m looking for. It’s a rather extensive amount of files, so I’d preferably not have any intervention in the mergin process.
This might be very problematic to do with a standard diff tool if the xml ‘nodes’ are in any way similar. For example:
file1:
file2:
A standard diff tool is going to highlight lines 2 and 4 as needing to be merged, but even if you automatically add the lines from file2, you’ll end up with an invalid xml file:
You really need a diff/merge tool that is xml-aware. I found a description of one called XmlMerge, along with an example that shows it doing exactly what you’re asking for. It’s part of EL4J.
There is a dormant effort called XUpdate that has a fair amount of tools around it (both for generating the XUpdate diffs and for applying them). There are also some .net classes that use a different foundation. You will need to do some scripting to use either of these systems I think.