views:

1148

answers:

7

How can I compare the content of two (or more) large .resx files? With hundreds of Name/Value pairs in each file, it'd be very helpful to view a combined version. I'm especially interested in Name/Value pairs which are present in the neutral culture but are not also specified in a culture-specific version.

A: 

You can use a tool like TortoiseSVN's diff (if you're using windows), just select both files, right click and then select "diff" form the tortoise submenu.

Pablo Fernandez
+2  A: 

Using simple diff on XML files can be totally useless, if the matching elements do not appear in the same order in both files. I have been looking for an XML-specific diff tool too, so far without success.

In the meantime, the workaround I have been using is this:

  • Open the resx files in the VS.
  • Select all [CTRL-A] and cut [CTRL-X] (this may take a while for large files - be patient)
  • Paste [CTRL-V] and save (this will re-create the resx files sorted by keys)

When both files are thus re-ordered, normal diff'ing becomes so much easier. You can quickly locate the missing keys by skimming through the diff now.

Ishmaeel
A: 

winmerge

http://www.winmerge.org/

Greg Dean
Does it have real XML support?
Ishmaeel
What is "real" xml support?
Greg Dean
What I mean by that is element-based comparison. Simple text diff will show changed lines, but ignore the XML hierarchy. I'll cook up an example that illustrates the problem as I see it.
Ishmaeel
+5  A: 

Although it's not a diff tool per se, RESX Synchronizer may help you out here. Its main use is to update the localized .resx files with new entries from the neutral language one, and remove any deleted items.

Possibly, the output generated by using it with the /v command line switch will be what you need. Otherwise, it does come with full C# source code, so possibly you can adapt it for your needs.

mdb
simply awesome. thx
Konstantinos
A: 

You could code something up using XmlDiff

http://msdn.microsoft.com/en-us/library/aa302294.aspx

Greg Dean
+2  A: 

There is a great freeware tool to edit resx files where you can see multiple languages at once and clearly see what is missing or extra - Zeta Resource Editor

A: 

I've tried several XMl Diff tools. Here's the summary(The requirement driven me to evalute is to diff the VS generated resx resource file, which I think microsoft make a big fault, the order of element is random, and WinForms always re-write the ImageStream if you just change a button's location and do nothing with the imageList)

  1. XmlDiff
  2. Araxis
  3. Altova DiffDog
  4. Xml Notepad
  5. examXML
  6. Liquid XML Studio 2009(There's a XML diff menu, but only a license version can use it. so I have no chance to give a try)

First of all, all the normal diff tools should not be considered because they know nothing of XML, they treat text files as just line of text.

  1. XmlDiff is the first tool I tried. It looks that it can do want I need, but after download the source code(VS2003) and compiled with VS2005(with a success auto grade) I can compile the small project smoothly. But when I compare two real resx file(1295 lines) it crashed. Debuging into the code does not give me a clue about what happened because I have no source code of the xmldiffpatch.dll XmlDiffPatch.View.dll And why I not try to choose to dig more in this tool is the output format, or GUI design, it output a HTML file with difference highlighted in a IE-hosted window. For large XML file diff, it's not easy to use.

  2. Xml Notepad has a simple builtin XML diff, according to the output window I think it internally use XmlDiff 's component. And the output is same as XmlDiff. I'll uninstall it.

  3. Araxis is much more a traditional text diff tool, it can also compares binary file, image file, folder, and word files, I like it very much for any diff task except XML, because it has not XML-aware diff options support

  4. Altova DiffDog Looks a complicated commerical product and it did contains an option to ignore the element order, which is the key feature for me.

But after trying it with the same real resx file(1295 lines, not a big one in my experience), I found that the "ignore element order" just not works well if the two element located at the very differenct places in the two files.

  1. examXML Looks a commerical product but a small product, but after trying it I found it's the most idea tool at present on my expectations.

There's also disappoint side: it crashed when I press F10 to navigate to next difference. The ignore order of element works well. There's one pitty that the customization of ignored element is not so much flexible.

label1.Size label1.Location label1.Width

I want to ignore all the difference on these elements whose name contains ".Size" or ".Location" or ".Width", but it's not possible to define such a condition at the same time. The customization doesnot support regular expression.

Anyway, I'll use examXML (with careful) to compare XML files.

赵如飞