Patch Method (XmlDocument, XmlReader)

Microsoft XML Diff

Microsoft XML Diff 1.0 and XML Patch 1.0

XmlPatch.Patch Method (XmlDocument, XmlReader)

Modifies the document in the XmlDocument by applying the XDL Diffgram parsed by an XmlReader.

[Visual Basic]
Overloads Public Sub Patch( _
  ByVal sourceDoc As XmlDocument, _
  ByVal diffgram As XmlReader _
public void Patch(
  XmlDocument sourceDoc,
  XmlReader diffgram


An XmlDocument containing the source document to be modified.
The XDL Diffgram that is parsed by the XmlReader to apply to the source document.


The following code sample loads a source document and an XDL Diffgram, and saves the changed sourceDoc into a new file called changed_doc.xml.

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

Public Class Sample

   Public Shared Sub Main()
      Dim sourceDoc As New XmlDocument()
      Dim myPatch As New XmlPatch()
      Dim myRdr As New XmlTextReader("diffgram.xml")
      myPatch.Patch(sourceDoc, myRdr)
   End Sub 'Main
End Class 'Sample 
using System;
using System.IO;
using System.Xml;
using Microsoft.XmlDiffPatch;

public class Sample 
    public static void Main() 
        XmlDocument sourceDoc = new XmlDocument();
        XmlPatch myPatch = new XmlPatch();
        XmlTextReader myRdr = new XmlTextReader("diffgram.xml");
        myPatch.Patch(sourceDoc, myRdr);


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

See Also

XmlPatch Class | XmlPatch Members | Microsoft.XmlDiffPatch

© 2002 Microsoft Corporation. All rights reserved.