The XML Diff Language (XDL) is a proprietary XML-based language for describing differences between two XML documents. Changes between two XML documents are described in a document called an XDL Diffgram.
The root element of the XDL Diffgram is
xd:xmldiff. It contains the version of the XDL Diffgram in the
version attribute, the XDL namespace declaration for the
xd: prefix, and the XML Diff options selected in the
options attribute when the XDL Diffgram was created. It also contains a
srcDocHash attribute with a number that is calculated from the source document, and is called a hash value. This number allows checking if an XML document is the correct source document the XDL Diffgram was created on. This check is performed by XML Patch tool. Additionally, it contains a
fragments attribute with value of
no. A value of
yes indicates that XML fragments were compared. A value of
no indicates that XML documents were compared. The child nodes of the
xd:xmldiff root element are elements describing the particular differences between the two XML documents or fragments.
The following example shows an original source document, a changed document, and the XDL Diffgram that results when a Compare method is run against the Source XML and Target XML documents, shown below.
<b> <a>Some text 1</a> <b>Some text 2</b> <c>Some text 3</c> <z> Another text <fob/> </z> </b>
<b> <yy>Some text 1</yy> <b>Some text 2</b> <c>Some text 3</c> <d>Some text 4</d> <z>Changed text</z> </b>
<?xml version="1.0" encoding="utf-16" ?> <xd:xmldiff version="1.0" srcDocHash="1225038152287875577" options="None" fragments="no" xmlns:xd="http://schemas.microsoft.com/xmltools/2002/xmldiff"> <xd:node match="1"> <xd:change match="1" name="yy" /> <xd:node match="3" /> <xd:add> <d>Some text 4</d> </xd:add> <xd:node match="4"> <xd:change match="1">Changed text</xd:change> <xd:remove match="2" /> </xd:node> </xd:node> </xd:xmldiff>