I have to be honest, I'm not really sure what you mean. In the first file you linked, in reference to XML nodes, I can't see any duplication...
And the second part, I'm not really sure what you want. I understand you want to delete the duplicate lines from each version of each file. But I don't get the bit about merging. What is the final result you want to achieve?
I'm probably just being stupid here, but I can't really work out what it is you want the tool to do. If you could try and explain it in another way or something, I might be able to help.
EDIT: With the nodes stuff: Do you mean deleting a whole array when it is duplicated? If so, I think that could be trickier, but I could try it. I won't until I get confirmation though, don't want to waste time on something that isn't right
Also, seeing as they couldn't be sorted, it would probably be a longer process.