Compare Method (String, String, Boolean)

Microsoft XML Diff

Microsoft XML Diff 1.0 and XML Patch 1.0

XmlDiff.Compare Method (String, String, Boolean)

Performs a comparison of XML documents or fragments.

[Visual Basic]
Overloads Public Function Compare( _
  ByVal sourceFile As String, _
  ByVal changedFile As String, _
  ByVal bFragments As Boolean _
) As Boolean
[C#]
public Boolean Compare(
  String sourceFile,
  String changedFile,
  Boolean bFragments
);

Parameters

sourceFile
A file name or URL containing the original source XML document or fragment to be used in the comparison.
changedFile
A file name or URL containing the changed XML document or fragment to be used in the comparison.
bFragments
A flag indicating whether the sourceFile and changedFile are well-formed XML documents (false) or whether they are fragments (true).

Example

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

Namespace XDConsole_CS
   Class Class1
      Public Overloads Shared Sub Main()
         Main(System.Environment.GetCommandLineArgs())
      End Sub
      
      Overloads Shared Sub Main(args() As String)
         Dim xmlDiff As New XmlDiff()
         Dim bSame As Boolean = xmlDiff.Compare("Source.xml", "Changed.xml", False)
      End Sub
   End Class
End Namespace 
[C#]
using System;
using System.Xml;
using System.IO;
using Microsoft.XmlDiffPatch;

namespace XDConsole_CS
{
    class Class1
    {
        static void Main(string[] args)
        {
            XmlDiff xmlDiff = new XmlDiff();
            bool bSame = xmlDiff.Compare("Source.xml", "Changed.xml", false);
        }
    }
}

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

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.