Algorithm Property

Microsoft XML Diff

Microsoft XML Diff 1.0 and XML Patch 1.0

XmlDiff.Agorithm Property

Specifies the algorithm that the will be used for comparing the documents. The type is XmlDiffAlgorithm Enumeration. The default is Auto.

[Visual Basic]
Public Property Algorithm() As XmlDiffAlgorithmn [C#]
public XmlDiffAlgorithm Options {set;}

Remarks

The following code sample shows how to use the Precise algorithm when comparing two documents.

[Visual Basic]
Imports System
Imports System.Xml
Imports Microsoft.XmlDiffPatch

Namespace TestCompare
   Class Class1
      Shared Sub Main()
        Dim diffWriter = New XmlTextWriter("diffgram.xml", New System.Text.UnicodeEncoding())
        Dim myDiff As New XmlDiff()
        myDiff.Algorithm = XmlDiffAlgorithm.Precise
        Dim bSame As Boolean = myDiff.Compare("source.xml", "changed.xml", False, diffWriter)
        Console.WriteLine("The answer is {0} ", bSame)
      End Sub
   End Class
End Namespace 

[C#]
using System;
using System.Xml;
using Microsoft.XmlDiffPatch;

namespace TestCompare
{
  class Class1
    {
        static void Main()
            {
            XmlWriter diffWriter = new XmlTextWriter("diffgram.xml", new System.Text.UnicodeEncoding()); 
            XmlDiff myDiff = new XmlDiff();
            myDiff.Algorithm = XmlDiffAlgorithm.Precise;
            bool bSame = myDiff.Compare("source.xml", "changed.xml", false, diffWriter);
        Console.WriteLine("The answer is {0} ", bSame);
            }
    }
}

For information on running the code samples, see Running XmlDiff and XmlPatch Class Code Samples.

For more information on the enumerations, see XmlDiffAlgorithm Enumeration.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP, Windows .NET Server

See Also

XmlDiff Class | XmlDiff Members | Microsoft.XmlDiffPatch

© 2002 Microsoft Corporation. All rights reserved.