使用 Beyond Compare(脚本)比较(排序)XML 并生成报告
我们必须比较两个不同但执行相同业务流程的响应(XML)。问题是我们正处于从大型机技术迁移到 Microsoft BizTalk 技术的过程中。大型机正在为超过 54 个客户端(桌面、Web、Web 服务)提供服务。大型机和 Microsoft BizTalk Server 都接受类似的请求,并且应该做出类似的响应。请求和响应格式采用 XML 格式。
正如我所说,54 个系统通过 Mainframe 连接,我们决定并行运行 Microsoft Server,这意味着无论到达 Mainframe 的任何请求,它的副本也将传递到 Microsoft BizTalk Server。而且,我们将来自两个服务器的每个响应的副本保存在物理位置。
现在,我们必须比较两个响应 (XML) 并生成差异报告(HTML 和 XML)。为此,我们使用 Beyond Compare 3 (Pro)。由于此比较过程必须按计划进行,因此我们通过 Beyond Compare 脚本来完成此操作。假设,我们必须要求 Beyond Compare 每小时运行一次比较。设计了一个小型应用程序来安排此操作并运行 Beyond Compare 脚本,如下所示:
#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
该脚本中的问题是必须对 XML 进行排序然后进行比较。在比较之前我们如何对 XML 进行排序?我已经从 ScooterSoftware 下载部分下载了 XML 排序 格式。但我不知道如何使用 XML Sort 对 XML 进行排序,然后生成报告。
请帮忙。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
安装 XML 排序规则后,它应该出现在文件格式列表的顶部,并且应该自动使用。如果不是,您是否以安装该格式的同一用户身份运行计划任务?如果没有,请执行以下任一操作:
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: