Is it possible to compare 2 XML files properly and get a good output?

Is it possible to compare 2 XML files properly and get a good output?

Here´s an example:

compare file1.xml with file2.xml

Write the differences into Another file

Really appreciate your answer

:0)

 

 

Yes it is possible. You would Compare-Object cmdlet. But it’s not straight forward. You will have to mention which property of that xml to compare.
I would suggest you to read the doc (Get-Help Compare-Object -Online) and give it a try. Post the code here when you are stuck or hit by an error.

For doing comparisons, I find powershell to be very…lackluster.

If you want to automate a comparison, I would suggest using Beyond Compare, it does have a command line you can use: bcomp.exe. There is a learning curve, but its pretty well documented. I have a powershell script where I call that to compare directories to each other post deployment.

\support\BC\Portable\bcomp.exe `@"BCCOmp.txt" $newStage\$site "$sitepath" "localhost_output.html" /silent |out-null
$MMF=(Get-Content .\localhost_output.html)
$MMF |findstr /i "Files" |out-file local.html;Start-Process local.html

BCCOmp.txt is a file that feeds the report generation:
log logfile.txt
criteria binary
load %1 %2
expand all
select all.diff.files
folder-report layout:summary  output-to:%3 output-options:html-color