BeyondCompare comparison of XML files - Ignore specific elements during folder compare

johkar picture johkar · Nov 4, 2015 · Viewed 11.4k times · Source

I'm comparing folders containing XML files and wish to ignore specific nodes in the files when the directory compare is done...whether they have a value or not.

File 1
<myElement>value</myElement>
File 2
<myElement/>

File 1
<myElement>value1</myElement>
File 2
<myElement>value2</myElement>

I have BeyondCompare 3 and am using the xmlTidy sorted attributes plugin.

I have searched the BeyondCompare forums and Googled and can't seem to find step by step instructions that work. I'm sure it isn't that hard but I'm just not getting it. Can you clear the fog for me or give me a link? Thanks.

Answer

Chris Kennedy picture Chris Kennedy · Nov 4, 2015

Here's how to ignore text differences in files in the Folder Compare:

  1. Load two folders in Beyond Compare's Folder Compare.
  2. Double click to view a pair of XML files in the Text Compare.
  3. Click the Rules toolbar button (referee icon).
  4. Click Edit Grammar.
  5. Click New.
  6. Name it MyElement.
  7. Select Delimited as the category.
  8. Text from: <myElement> to: </myElement>.
  9. Click OK.
  10. Click OK.
  11. Uncheck myElement to make it unimportant.
  12. Change the dropdown at the bottom of the dialog from Use for this view only to Use for all files within parent session or Update session defaults.
  13. Close the Text Compare tab.
  14. In the Folder Compare, click the Rules toolbar button (referee icon).
  15. Check Compare Contents and select Rules-based comparison.
  16. Click OK.
  17. Make sure View > Ignore Unimportant Differences is turned on.

The default settings in the Folder Compare use file size and modified date for comparison. Rules-based comparison uses the same content comparison method as double clicking to view file contents.

See also the article Define Unimportant Text in Beyond Compare. It describes ignoring differences when viewing a pair of files in the Text Compare.