No announcement yet.

Beyond Compare 3 Comparing two XML-Files and show output in HTML

  • Filter
  • Time
  • Show
Clear All
new posts

  • Beyond Compare 3 Comparing two XML-Files and show output in HTML

    Hello Everyone,

    I tried to play around with the Beyond Compare Scripting.
    I wanted to be able to compare two XML-Files and show the differences in a HTML-File.

    Here's the Script that I'm using:

    load "C:\Users\User\BCTest"
    filter "*.xml"
    expand all
    select all
    text-report layout:side-by-side options:display-all,line-numbers output-to:%1 output-options:html-color​

    I'm running this whole thing from the command line as follows:

    BCompare.exe @"C:\Users\User\BCTest\BCScript.txt" "C:\Users\User\BCTest\file1.xml" "C:\Users\User\BCTest\file2.xml" "C:\Users\User\BCTest\output.html"

    But when I then open the generated HTML File I get the following view:

    ​Why is everything showing as a difference? The only thing that has been changed is the Price-Tag on line 10.
    Am I doing something wrong or did I understand this whole thing wrong?

    Thanks for any help!
    Kind Regards​

  • #2

    The combination of script and parameters don't quite line up with our expected syntax. Let me break down the two approaches:

    Your script is written in a way to load a folder comparison, select all the xml content, and then generate a single report (containing all the different content of the selected files). You can preview this in the interface by loading two base folders, side by side, in the Folder Compare, set the name filter in the toolbar from "*.*" to "*.xml", then use the Display Filters to Show Differences, Edit menu -> Expand All, Edit menu -> Select All Files, Actions menu -> File Compare Report (if this last actions menu item is not visible, the select all files command snagged an archive; use a name filter to remove them or test with a small manual selection of only .xml files).
    The script here is only loading one target folder, however, so it would literally find every xml file different (orphan, only on one side) and all the content of the xml would be included.

    However, that isn't happening because of your parameters. Your parameters appear to be attempting to pass in a single pair of xml files you would like to compare, but the script is only using one of the parameters.

    The text-report, without trailing file parameters, acts on a selection. If given files, you do not need a selection or even a load command. Your entire script file would be a single line:
    text-report layout:side-by-side options:display-all,line-numbers output-to:"%3" output-options:html-color​ "%1" "%2"

    This takes in each parameter in order, so 1 and 2 are your files at the very end, and the output-to points to 3, which is your html file path. I also added "quotes" to help with any potential whitespace in any of the file paths.

    You can also perform this in the interface by loading a blank Text Compare session, loading your two .xml files into it, and then using the Session menu -> Text Compare Report dialog.

    I'd suggest trying the interface first, if you aren't sure which type of report you want to generate. Once you know the steps to take in the interface, we can help with the script that performs the matching steps.
    Aaron P Scooter Software


    • #3
      Hello Aaron,

      Thanks a lot for your help.
      I was able to figure it out thanks to your input.

      Appreciate the fast help

      Take care & Kind Regards