Search code examples
xmlscriptingcomparisonbeyondcomparebeyondcompare3

Comparing (sorted) XMLs using Beyond Compare (script) and Generate Report


We have to compare responses (XML) of two different but they are doing the same business processes. The thing is we are in a process of migrating from Mainframe Technology to Microsoft BizTalk Technology. Mainframe is serving more than 54 clients (desktop, web, web services). Both, Mainframe and Microsoft BizTalk Server take similar requests and should response similar. The request and response formats are in XML.

As I said 54 systems are connected through Mainframe, we decided to run Microsoft Server parallel to it which means whatever request comes to Mainframe a copy of it will also pass to Microsoft BizTalk Server. And, we are saving copy of each responses coming from both servers in a physical location.

Now, we have to compare both responses (XML) and generate difference report (HTML and XML). For that, we are using Beyond Compare 3 (Pro). As this comparing process has to go on in a schedule, we are doing this by Beyond Compare Scripting. Suppose, we have to ask Beyond Compare to run comparison after every hour. A small application is designed to schedule this and run Beyond Compare Script which is as follows:

#compare the text contents of the files
criteria rules-based
#only compare delphi source files, ignore the archive folder
filter "*.xml;*.xsd;*.xsl"


load "F:\SE Response Folder\04\013-07" "F:\MF Response Folder\ProcessedFolder\04\013-07"


#expand to affect subfolders and files
expand all

#select updated files

select lt.diff.files rt.diff.files

#generate a report of the differences

file-report layout:xml options:display-mismatches output-to:C:\report123.xml

The problem in this script is XML has to be sorted and then compare. How do we sort XML before comparison? I've downloaded the XML Sort format from ScooterSoftware download section. But I don't know how to use XML Sort to sort XMLs and then generate report.

Please, help.


Solution

  • After you install the XML Sort rule it should appear at the top of your file format list and should be used automatically. If it's not, are you running the scheduled task as the same user that installed the format? If not, either:

    • install it again as that user
    • copy the BCFileFormats.xml from your %AppData% directory to the relevant user
    • create a portable BC install (the installer has that option), set it up, and run the scheduled task using it instead of the standard install