XML Diff Functionality
XmlDiff is a class used to compare two XML documents. XmlDiff detects additions, deletions and other changes between the two XML documents. It also detects structural changes, for example when an XML subtree is moved. XmlDiff produces an XDL Diffgram written in XML Diff Language Diffgram (XDL). The XDL Diffgram describes the differences between the two XML documents. The XDL Diffgram can be used to display differences, or to perform a patch operation using XmlPatch Functionality.
XDL Diffgrams contain information regarding additions, changes, or removals of document content, or content being moved from one place in the tree to another. The XDL Diffgram describes the changes by use of the XML Diff Language (XDL) and describes in detail what nodes in the source document were changed, and how they were changed.
XmlDiff class performs XML-based comparison of the XML documents as opposed to a common lexical comparison. This means that the XmlDiff class:
- Ignores the order attributes.
- Ignores insignificant white spaces.
- Does not distinguish between an empty element
<a/>
and element with no content<a></a>
. - Is not affected by the document encoding.
You can also set one or more properties on the XmlDiff class to direct what content it includes in the comparison. For example, you can set a flag to ignore comments that are different between the two documents, or ignore processing instructions. For more information, see Setting Options that Affect the Comparison.
There are also different algorithms available to use when comparing the data. The algorithm chosen affects the speed of the comparison, as well as the output in the XDL Diffgram. For more information, see Selecting the Algorithm for the Comparison.
See Also
Running Comparisons Between Documents, Fragments, or Nodes | XML Diff Language (Diffgram) | Extended Operations | Example of a Diffgram | XmlDiff Class