Tool or library for comparing xml files

32,809

Solution 1

If I understand your problem, you likely have an application that uses XML files as the data storage and the GUI abstracts the "technical" tag names into "user friendly" labels - again, I am assuming. So it would be a natural extension to view differences in a similar way. I am also assuming your application doesn't have a diff facility that follows the "abstraction" concept.

I did some searching and found one app (ExamXML) that seems to come close with highlighting features. I downloaded the eval version and tested your files against it:

http://www.programmedintheusa.com/images/stack547399.png

It does a pretty good job of highlighting the differences. It seems pretty interactive and pops up with how many differences. It looks like you can change the colors it uses, so maybe you can use grays and whites to de-emphasize the tags. It also seems to have a lot of options that you can pre-set for your users as well.

I want to note that you will be hard pressed to find an XML comparison tool that will not show the tag names, as the tags are what give the content context. If you take away context, it becomes difficult to understand the data being displayed. Anyhow, maybe this tool might be helpful. Have you also tried to show your users some of these tools and see what they are willing to tolerate, sometimes they may surprise you. Hope this helps!

Solution 2

I am very surprised nobody mentioned Microsoft's XML NotePad

It's free and it can create a pretty good comparison, telling which elements/attributes have changed, moved, been deleted, etc.:

(Sorry if the screenshots are a little wide).

You can also apply XLSes to the XML file and do various editing operations. Well worth a try.

Solution 3

SourceGear's DiffMerge is free for a single-user:

http://www.sourcegear.com/diffmerge/

Solution 4

Altova diffDog XML Spy and diffDog are exceptional tools. Pry them from my cold dead hands, kinda stuff.

Solution 5

I might try DeltaXML + an XSLT transform to get the specific result that you want. One problem with using plain-text compare tools with XML is that the physical form of an XML document (its indenting, etc.) can change even if the content itself doesn't, which could lead to a lot of false positives. DeltaXML is a very good tool for comparing document-based XML.

Also, depending on the editor your users use, it may have XML differencing built-in. For example, Arbortext Editor has a good tool that shows the text (not the tags) with changes highlighted / struck-through.

Share:
32,809
VichitraVij
Author by

VichitraVij

hi, I live in conshohocken, work in malvern. My App: http://itunes.apple.com/us/app/kickoff/id427696915?mt=8 My Website: http://nofouls.com My Band: http://www.facebook.com/TheColinizers

Updated on July 09, 2022

Comments

  • VichitraVij
    VichitraVij almost 2 years

    I am looking for an XML comparing tool that understands xml. It cannot be a line by line comparision like WinMerge or Beyond Compare.

    An ideal solution would be one that shows changes similar to the way Word 2007 shows track changes. DeltaXML does this, but does not come with a real GUI 'out of the box' and is $500 per user!:

    ExamXml works out of the box but displays the differences in a confusing manner. It does not have a concept of before and after, it just shows the differences:

    alt text
    (source: a7soft.com)

    The tool should have the concept of using attributes as a key, so that it does not think that a reordered list of elements has changed. DeltaXML does this but I failed to set it up correctly for the screen shot.


    UPDATE:

    So far ExamlXML is the best out of the box solution. But it lacks the change management concepts of DeltaXML. Resulting in some usability problems.

    DeltaXML is pretty much the solution I need, but something with more functionality out of the box would be better. DeltaXML requires writing java code to call the api, along with writing XSL to transform the xml into the expected input.

    • BobbyShaftoe
      BobbyShaftoe over 15 years
      Who is downvoting all the answers to this question? Pretty childish.
    • Diuter
      Diuter over 15 years
      I upvoted a number of them myself, as I feel that all the utilities mentioned are quality applications that nontechnical people could handle with some training.
    • CodingWithSpike
      CodingWithSpike over 15 years
      I have 1/2 of a solution to this implemented already in .NET (currently merges XML files, but part of that is diffing them to see what to merge). I could 1-off a copy that does what you want, if you want to better define the output: Graphical or text only? command line or win? *nix, win or mac?
    • VichitraVij
      VichitraVij over 15 years
      First off Jeff, you are the man! Anyway, its a little late but I will elaborate. My client has users that author content (write books) in a GUI app that looks like Word, but saves content in XML format. But the app does not have a diff or track change tool. So they went with ExamXML for this. :)
  • VichitraVij
    VichitraVij over 15 years
    Thanks for the link. I ran the utility on some files that the user would of, and the compare output was a nice format. Unfortunately it inaccurately marked some of the xml as different when it was not.
  • Peter T. LaComb Jr.
    Peter T. LaComb Jr. over 15 years
    Be sure to set the preferences to show differences only.
  • VichitraVij
    VichitraVij over 15 years
    Thanks John, this is the best answer so far.
  • VichitraVij
    VichitraVij over 15 years
    This looks like a good solution, although on the expensive end ($500 per user).
  • VichitraVij
    VichitraVij over 15 years
    I have tested this and it simple outputs incorrect results.
  • VichitraVij
    VichitraVij over 15 years
    Can you tell me how to get to the compare feature? Thanks.
  • Sylverdrag
    Sylverdrag over 15 years
    Sure. You open a xml file, then you go to the "view" menu and click on "compare XML files"
  • bortzmeyer
    bortzmeyer over 15 years
    Is it XML sensitive? I do not think so, I believe it just treats them as plain text files and so spot diffs that do not exist in the XML infoset (such as a change of encoding).
  • mspoerr
    mspoerr over 15 years
    you are right - its only text comparison.
  • paradisonoir
    paradisonoir over 13 years
    I just tried XMLNotepad and I found it very interesting. Thanks for suggesting that.
  • Somesh Rao
    Somesh Rao almost 11 years
    Just tried XML Notepad, and it seemed to have some bugs. Line from the xml file (read using vi) was <COVARIANCE factor-ref="VALUE" value="0.000729"/> but the diff in XML Notepad showed it as <COVARIANCE COVARIANCE="VALUE" COVARIANCE="0.000729"/>. The number 0.000729 is unique in the file, so I am positive I am seeing the same element.
  • Jirka Hanika
    Jirka Hanika almost 11 years
    What was on the picture before it was removed? A screenshot?
  • John Virgolino
    John Virgolino over 10 years
    @JirkaHanika Yes. Not sure why it went away like that.
  • gravity
    gravity about 8 years
    I would agree, XML Notepad is no longer updated, and is riddled with bugs, particularly when expanding or closing the hierarchy. If I had to use it, I could, but there's more robust and better designed tools out there.