Have a look at File comparison tools, from which I am using WinMerge. It has an ability to compare XML documents (you may wish to enable DisplayXMLFiles prefilter for v2.14.0 or PrettifyXML for v2.16.x).

DisplayXMLFiles.dll - This plugin pretty-prints XML files nicely by inserting tabs and line breaks. This is useful for XML files that do not have line returns in convenient locations.

Note for v2.16.x

The plugin PrettifyXML is supplied with the software package. It can be activated as following:

  • Make sure that Plugins โ†’ Plugin Settings โ†’ Enable plugins is enabled.
  • Then use either File โ†’ Recompare As โ†’ Prettify XML or Plugins โ†’ Scripts โ†’ Prettify XML

For those who wish to play with deprecated DisplayXMLFiles, he needs to download e.g. winmerge-2.16.14-full-src.7z and copy Plugins\dlls\X64\DisplayXMLFiles.dll to WinMerge\MergePlugins\.

See also my feature comparison table.

Answer from dma_k on Stack Overflow
Top answer
1 of 11
36

Have a look at File comparison tools, from which I am using WinMerge. It has an ability to compare XML documents (you may wish to enable DisplayXMLFiles prefilter for v2.14.0 or PrettifyXML for v2.16.x).

DisplayXMLFiles.dll - This plugin pretty-prints XML files nicely by inserting tabs and line breaks. This is useful for XML files that do not have line returns in convenient locations.

Note for v2.16.x

The plugin PrettifyXML is supplied with the software package. It can be activated as following:

  • Make sure that Plugins โ†’ Plugin Settings โ†’ Enable plugins is enabled.
  • Then use either File โ†’ Recompare As โ†’ Prettify XML or Plugins โ†’ Scripts โ†’ Prettify XML

For those who wish to play with deprecated DisplayXMLFiles, he needs to download e.g. winmerge-2.16.14-full-src.7z and copy Plugins\dlls\X64\DisplayXMLFiles.dll to WinMerge\MergePlugins\.

See also my feature comparison table.

2 of 11
22

I wrote and released a Windows application that specifically solves the problem of comparing and merging XML files.

Project: Merge can perform two and three way comparisons and merges of any XML file (where two of the files are considered to be independent revisions of a common base file). You can instruct it to identify elements within the input files by attribute values, or the content of child elements, among other things.

It is fully controllable via the command line and can also generate text reports containing the differences between the files.

๐ŸŒ
Altova
altova.com โ€บ xmlspy-xml-editor โ€บ compare-xml
Compare XML Files | Altova
DiffDog also supports XML-aware comparisons, including graphical XML Schema differencing and will automatically generate an XSLT stylesheet to transform XML documents to the new XSD. You can download a free trial of DiffDog, or test drive the MissionKit tool suite, which includes both XMLSpy and DiffDog.
๐ŸŒ
TextCompare
textcompare.org โ€บ xml
Online Xml Compare Tool
No Installation: This is a web based tool, no software installtion required. It works on any modern browser like Firefox, Chrome, Edge etc on Windows, Mac or Linux based computer. Unlimited: There is no limit on number of comparisons you can do. You can compare as many Xml files as you want. No, all the processing is done on your ๐Ÿ–ฅ browser, so nothing is saved on our server unless you choose to save to share online. For private sharing, you can download ...
๐ŸŒ
Windows10download.com
windows10download.com โ€บ w10-xml-diff-tool.html
Xml Diff Tool Windows 10 downloads - Free Xml Diff Tool download for Windows 10 - Windows 10 Download
Discover the power of Altova DiffDog, the ultimate comparison tool designed for Windows 10 users who demand precision and efficiency. Developed by Altova Inc., DiffDog streamlines the process of comparing files, folders, and ...
๐ŸŒ
SemanticDiff
semanticdiff.com โ€บ online-diff โ€บ xml
SemanticDiff - Compare XML Online
Compare two XML files in your browser using our free semantic diff tool. See how values and attributes differ while ignoring formatting changes.
๐ŸŒ
Ali-ulvi
ali-ulvi.github.io โ€บ XML_equality_checker_comparer.html
XML Compare Test Tool
Sometimes we need to compare XML files ignoring their elements' order but there was not such FREE tool before. Now there is! Download here. This tool checks two XMLs whether they are same, if not prints the first difference. Great for XML testing.
๐ŸŒ
ExtendsClass
extendsclass.com โ€บ xml-diff.html
XML diff - Compare xml online
This is the only proper xml diff checker. Most comparison tools are just line by line comparators, which is useless if the xml is formatted into a single line or if the data is not in order. A real xml comparison tool should compare randomly ordered data.
Find elsewhere
๐ŸŒ
CoreFiling
corefiling.com โ€บ home โ€บ open source tools โ€บ xml comparison tool
Free Online XML Comparison Tool
June 20, 2025 - CoreFiling XML Differences uses XML Pretty Printer and diff to display differences between XML files in an easy-to-read format.
๐ŸŒ
Altova
altova.com โ€บ diffdog
DiffDog Diff/Merge Tool | Altova
Altova DiffDog includes enhanced support to diff/merge Microsoft Office Open XML (OOXML) files. Many diff/merge tools treat Office Open XML (OOXML) files as binary file types that are simply recognized as identical or different based on file size and modification date.
๐ŸŒ
Stylus Studio
stylusstudio.com โ€บ xml-diff.html
XML Diff Tool
The bottom right of this illustration shows Stylus Studioยฎ's Directory differencing tool that allows you to compare entire directories. The XML Diff tool is integrated with the XML Tree View and the XML Text View of Stylus Studioยฎ's XML Editor, and switching views is just a matter of choosing ...
๐ŸŒ
Oxygen XML
oxygenxml.com โ€บ xml_diff_and_merge.html
Oxygen Compare and Merge Tools
These are powerful and easy-to-use tools that will do the job fast and thoroughly. With the possibilities of comparison and merging, it is easy to manage multiple changes. The comparison of a pair of files is done by opening them in two editors arranged in a side by side layout. You can edit both files and the differences are refreshed when you save the modified documents. You can also compare XML fragments, without selecting files, by copying and pasting them into either side of the comparison tool.
Top answer
1 of 6
9

Technically, XMLs are different

  • if they have whitespaces or not
  • if the order is different
  • if they have comments or not
  • if they have processing instructions or not
  • if their encoding is different
  • if their namespaces are different

but of course you can decide to ignore that or not, based on the semantic information an XML does not have.

Microsoft has developed the XML Diff and Patch tool for this purpose and you can integrate it in your own applications.

Note: the tool installs as "SQLXML Bulkload in .NET Code Sample" and comes with a Visual Studio solution XmlDiffView.sln that you need to compile yourself. Some basic programming knowledge in C# and Visual Studio Community Edition should be ok.

However, as mentioned in one of the answers on Stack Overflow, it has been compiled and made available on Bitbucket.

After that it comes with a UI that let's you choose the various XML comparison options:

When I apply it to the 2 XMLs of your questions, it throws an exception. That is because of the namespaces which are not defined. After removing the namespaces, it says:

2 of 6
6

Focusing on the part that moved sections should be reported as no difference made me think of https://semanticmerge.com/, which doesn't compare XML-files, but C# and C code. And as it understand those languages it is able to display if code has moved and not changed.

This leads to an alternative approach for this question: Could it be possible to translate the XML into C# classes, and then do a semantic merge on the resulting code?

One possible approach, if this tool is not written already, could be to translate each and every element to classes, and each attribute (and body texts) to a string property within that class. If you want to ignore namespaces, then let your translator remove them in the translation process.

I translated the XML example given as proof of concept and got the following:

class soapenv__Body {
  class mes__GetItem {
    class mes__ItemShape {
      class typ__BaseShape {
          string body="IdOnly";
      }
      class typ__BodyType {
          string body="Textus";
      }
      class typ__AdditionalProperties {
        class typ__FieldURI  {
            string FieldURI="item:Subject";
        }
        class typ__FieldURI  {
            string FieldURI="item:Categories"; 
        }
      }
    }
    class mes__ItemIds {
      class typ__ItemId {
          string Id="AAMYAAA=";
      }
    }
  }
}

Then I switched the mes:ItemIds and mes:ItemShape and changed the text to Textus. Compared the following two files in Semantic Merge and got the following image:

In this image one can see the move, indicated by the M icon, and the change in text indicated by the C icon. Lines indicates where the different parts have moved/changed, and it possible to actually see the differences if they exist.

Note that Semantic Merge even though understanding C# code, isn't to strict on the identical class names of typ__FieldURI, which could be a nice features as XML can contain multiple nodes with the same name.

Summa summarum: Semantic Merge can correctly identify the XML as identical (or not) even though elements move, if you can convert the XML into a C# class structure.

๐ŸŒ
Xlcompare
xlcompare.com โ€บ compare-xml-files.html
Compare XML Files Online. Free. No Upload. Get the Semantic XML diffs.
October 3, 2009 - Compare two XML docs and get the difference online. Drop your files on this page and get the highlighted diffs. Get semantic XML differences by comparing XML documents with key nodes and attributes.
๐ŸŒ
SourceForge
diffxml.sourceforge.net
diffxml - XML Diff and Patch Utilities
diffxml & patchxml: Tools for comparing and patching XML files ยท The standard Unix tools diff and patch are used to find the differences between text files and to apply the differences. These tools operate on a line by line basis using well-studied methods for computing the longest common ...
๐ŸŒ
GitHub
github.com โ€บ Shoobx โ€บ xmldiff
GitHub - Shoobx/xmldiff: A library and command line utility for diffing xml
A library and command line utility for diffing xml - Shoobx/xmldiff
Starred by 226 users
Forked by 53 users
Languages ย  Python 98.7% | Python 98.7%
๐ŸŒ
Minifier
minifier.org โ€บ xml-compare
XML Compare - Online XML Diff Checker
No need for downloads or installations. Use the XML comparison tool directly in your browser for quick and secure XML comparison.
๐ŸŒ
GitHub
github.com โ€บ vkononov โ€บ compare-xml
GitHub - vkononov/compare-xml: CompareXML is a fast, lightweight and feature-rich tool that will solve your XML/HTML comparison or diffing needs. its purpose is to compare two instances of Nokogiri::XML::Node or Nokogiri::XML::NodeSet for equality or equivalency.
CompareXML is a fast, lightweight and feature-rich tool that will solve your XML/HTML comparison or diffing needs. its purpose is to compare two instances of Nokogiri::XML::Node or Nokogiri::XML::NodeSet for equality or equivalency.
Starred by 13 users
Forked by 3 users
Languages ย  Ruby 58.1% | HTML 41.6% | Shell 0.3% | Ruby 58.1% | HTML 41.6% | Shell 0.3%
๐ŸŒ
Online Text Compare
onlinetextcompare.com โ€บ xml
Compare XML files online
FREE two-way XML format, diff and merge tool. No Signup required. Nothing to install. All comparisons are 100% private, secure and happens locally right in your web browser