Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xml diff compare in dotnet core 2.0

I am writing an MVC webapp in AspNetCore 2.0 and need to identify and locate changes in xml documents i produce so I can mark the changed elements and determine if a minor or major version increment is needed.

When searching for answers on how to do this I did not find many concrete answers.

I found a port of the old XmlDiffPatch tool but it requires framework and apparently don't work on core. The functionality of this class is a little sparse but very nice and fast and once I figured out how the diffgram was structured i could easily use it to identify the changed sections in my document.

However I was thinking (hoping) that the reason for not finding many posts about the subject maybe is that this is such a trivial task that no one cared to write about it.

What is currently the best api for performing this task?

(What are the odds that corefx team will introduce XmlDiffPatch to core 2.0?)

like image 413
Henrik Poulsen Avatar asked Oct 25 '25 08:10

Henrik Poulsen


1 Answers

After hours of further research I came to the conclusion that the XmlDiffPatch had the functionality I liked most and I found that if I installed .Net framework 1.1, I could install the toolkit from MS Download and in this was included the original source code.

I put the .cs files into a new NetStandard2.0 classlib project and the code compiled without issues.

I pushed a package named XmlDiffPatch.Core to NuGet and also did the same for XmlDiffView (called XmlDiffView.Core) so others can use it. (The packages have been delisted on NuGet)

like image 197
Henrik Poulsen Avatar answered Oct 27 '25 02:10

Henrik Poulsen