Loe inglise keeles

Jagamisviis:


DTSXMLDiffAlgorithm Enum

Definition

Specifies which algorithm to use when comparing XML documents.

C#
public enum DTSXMLDiffAlgorithm
Inheritance
DTSXMLDiffAlgorithm

Fields

Name Value Description
Auto 0

Default. Chooses the comparison algorithm for you depending on the size and assumed number of changes in the compared documents.

Fast 1

Compares the two XML documents by traversing the XML tree and comparing it node-by-node. This algorithm is very fast but may produce less precise results. For example, it may detect both an add and remove operation on a node instead of a move operation.

Precise 2

Compares files based on an algorithm for finding the editing distance between trees, also known as Zhang-Shasha algorithm. This algorithm gives very precise results but it may be very slow on large XML documents with many changes.

Examples

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);  
            }  
    }  
}  

Applies to

Toode Versioonid
SQL Server .NET SDK 2016, 2017, 2019