1

I am running an XML request on two separate servers (test and production) and comparing the XML response (message payload).

Manually we compare the responses on tools like Beyond Compare and see the differences highlighted.

We are trying to automate this, and display the differences on the webpage (maybe a screenshot from Beyond Compare) .

Can we somehow keep the comparison tool on the server and take the screenshots from there and display on the webpage? Or

Is there some other tool possible?

Or the only way would be to trigger the comparison tool from the user's machine.

Please suggest the correct way to do it or point to a documentation.

Thank You.

Ejaz
  • 1,504
  • 3
  • 25
  • 51
  • Possible duplicate of [Looking for a JavaScript XML diff tool](http://stackoverflow.com/questions/12896524/looking-for-a-javascript-xml-diff-tool) – Hitmands Feb 14 '17 at 05:59

2 Answers2

3

You should have a look at node-xml-compare and sax.js

var xmlcompare = require('node-xml-compare');

xml1 = "<sample><a>1</a><a>2</a><a>4</a><b>4</b></sample>";
xml2 = "<sample><a>2</a><a>1</a><a>3</a><c>3</c></sample>";

xmlcompare(xml1, xml2, function(result) {

    console.log('result', result);

});
Hitmands
  • 13,491
  • 4
  • 34
  • 69
1

You can automate a comparison in Beyond Compare, then output the comparison as an HTML report using BC's built in command-line scripting feature.

Script:

file-report layout:side-by-side options:ignore-unimportant,display-mismatches output-to:"%3" "%1" "%2"

The @ character makes Beyond Compare run a file as a script rather than load it for interactive comparison.

Command line:

"c:\program files\beyond compare 4\bcompare.exe" @c:\script.txt c:\file1.xml c:\file2.xml c:\report.html

See the Using Beyond Compare > Scripts and Scripting Reference topics in Beyond Compare 4's help file for more on scripting.

Chris Kennedy
  • 2,639
  • 12
  • 11
  • thank you. I am able to create a `.html` report now. I have one more question, I'll create a new thread. Thank you :-) – Ejaz Feb 15 '17 at 15:01