Skip to content

Commit

Permalink
adding tool XmlDiffPatch
Browse files Browse the repository at this point in the history
  • Loading branch information
fschwiet committed Jan 25, 2011
1 parent 0ac401d commit 7d126f3
Show file tree
Hide file tree
Showing 50 changed files with 12,974 additions and 0 deletions.
Binary file added tools/XmlDiffPatch/Bin/XmlDiff.exe
Binary file not shown.
Binary file added tools/XmlDiffPatch/Bin/XmlPatch.exe
Binary file not shown.
Binary file added tools/XmlDiffPatch/Bin/xmldiffpatch.dll
Binary file not shown.
120 changes: 120 additions & 0 deletions tools/XmlDiffPatch/Doc/eula.rtf

Large diffs are not rendered by default.

84 changes: 84 additions & 0 deletions tools/XmlDiffPatch/Doc/readme.txt
@@ -0,0 +1,84 @@
***************************************************************
Microsoft XML Diff and Patch 1.0
Readme File

***************************************************************
(c) Copyright Microsoft Corporation, 2002. All rights reserved.

This file contains information about this release. You
should read this before using the web release.

***************************************************************
Contents
***************************************************************
1.0 Introduction
1.1 Guidelines
2.0 Installing Microsoft XML Diff and Patch 1.0
2.1 System Requirements
2.2 Files Copied
3.0 Questions/Comments

***************************************************************
1.0 Introduction
***************************************************************
If you are a first time user of Microsoft XML Diff and Patch,
read the documentation. The conceptual material in the
documentation is written to provide quick start to new users.

The tool is provided as is.

-------------------------------
1.1 Guidelines
-------------------------------

* Changing diffgrams created by the tool is not recommended.
The tool might not be able to patch the original file if
the diffgram is modified.

* Relying on diffgrams generated by the tool directly (e.g.
reading them in a program and doing operations based on the
information in the diffgrams) is not recommended. Microsoft
reserves the right to change the diffgram format without
notice.


***************************************************************
2.0 Installing the Microsoft XML Diff and Patch 1.0
***************************************************************
You must have Windows Installer 2.0 installed in order to
install the Microsoft XML Diff and Patch 1.0. Download and
install Windows installer from the location listed below for
your platform:

* Windows XP - Windows Installer 2.0 is already installed

* Windows NT, Windows 2000:

http://www.microsoft.com/downloads/release.asp?releaseid=32832

* Windows ME/9x:

http://www.microsoft.com/downloads/release.asp?ReleaseID=32831

Double click on the xmldiffpatch.msi file, or type
"start xmldiffpatch.msi" at a command prompt to install the
Microsoft XML Diff and Patch 1.0.

-----------------------
2.1 System Requirements
-----------------------
* Microsoft .NET Framework 1.0 is a pre-requirement for the tool

-----------------------
2.2 Files Copied
-----------------------
The Microsoft XML Diff and Patch 1.0 installer package (MSI file)
installs all the necessary files on your machine. The files are
copied to the folder C:\Program Files\XmlDiffPatch.

***************************************************************
3.0 Questions and Comments
***************************************************************
Please post questions and comments to the Extreme XML Message Board at
http://www.gotdotnet.com/community/messageboard/MessageBoard.aspx?id=207
or send email to wdxtools@microsoft.com.
Binary file added tools/XmlDiffPatch/Doc/xmldiff.chm
Binary file not shown.
58 changes: 58 additions & 0 deletions tools/XmlDiffPatch/Samples/XmlDiff/AssemblyInfo.cs
@@ -0,0 +1,58 @@
using System.Reflection;
using System.Runtime.CompilerServices;

//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:

[assembly: AssemblyVersion("1.0.*")]

//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
138 changes: 138 additions & 0 deletions tools/XmlDiffPatch/Samples/XmlDiff/Class1.cs
@@ -0,0 +1,138 @@
using System;
using System.Xml;
using System.Text;
using Microsoft.XmlDiffPatch;

namespace XmlDiffApp {
class Class1 {
static void Main(string[] args) {
bool fragments = false;
XmlDiffAlgorithm algorithm = XmlDiffAlgorithm.Auto;
XmlDiffOptions options = XmlDiffOptions.None;

// process options
int curArgsIndex = 0;
while ( curArgsIndex < args.Length &&
( args[curArgsIndex][0] == '/' || args[curArgsIndex][0] == '-' ) ) {

if ( args[curArgsIndex].Length != 2 ) {
Console.WriteLine( "Invalid option: " + args[curArgsIndex] );
WriteUsage();
return;
}

switch ( args[curArgsIndex][1] ) {
case 'o':
options |= XmlDiffOptions.IgnoreChildOrder;
break;
case 'c':
options |= XmlDiffOptions.IgnoreComments;
break;
case 'p':
options |= XmlDiffOptions.IgnorePI;
break;
case 'w':
options |= XmlDiffOptions.IgnoreWhitespace;
break;
case 'n':
options |= XmlDiffOptions.IgnoreNamespaces;
break;
case 'r':
options |= XmlDiffOptions.IgnorePrefixes;
break;
case 'x':
options |= XmlDiffOptions.IgnoreXmlDecl;
break;
case 'd':
options |= XmlDiffOptions.IgnoreDtd;
break;
case 'f':
fragments = true;
break;
case 't':
algorithm = XmlDiffAlgorithm.Fast;
break;
case 'z':
algorithm = XmlDiffAlgorithm.Precise;
break;
case '?':
WriteUsage();
return;
default:
Console.Write( "Invalid option: " + args[curArgsIndex] + "\n" );
return;
}
curArgsIndex++;
}

if ( args.Length < 2 ) {
Console.WriteLine( "Invalid arguments." );
WriteUsage();
return;
}

// extract names from command line
string sourceXmlFileName = args[ curArgsIndex ];
string changedXmlFileName = args[ curArgsIndex + 1 ];
string diffgramFileName = ( curArgsIndex + 2 < args.Length ) ? args[ curArgsIndex + 2 ] : null;

Console.WriteLine( "Comparing " + sourceXmlFileName + " to " + changedXmlFileName );

// create XmlTextWriter where the diffgram will be saved
XmlWriter diffgramWriter = null;
if ( diffgramFileName != null ) {
diffgramWriter = new XmlTextWriter( diffgramFileName, Encoding.Unicode );
}

// create XmlDiff object & set the desired options and algorithm
XmlDiff xmlDiff = new XmlDiff( options );
xmlDiff.Algorithm = algorithm;

// Compare the XML files
bool bEqual = false;
try {
bEqual = xmlDiff.Compare( sourceXmlFileName, changedXmlFileName, fragments, diffgramWriter );
}
catch (Exception e) {
WriteError(e.Message);
return;
}
if (bEqual) {
Console.WriteLine( "Files are identical." );
}
else {
Console.WriteLine( "Files are different." );
}
if ( diffgramWriter != null ) {
diffgramWriter.Close();
Console.WriteLine( "XDL diffgram has been saved to " + diffgramFileName + "." );
}
}

static private void WriteError(string errorMessage) {
Console.WriteLine( "Error:" + errorMessage);
}

static private void WriteUsage() {
Console.WriteLine(
"USAGE: testapp [options] <source_xml> <changed_xml> [<diffgram>]\n\n" +
"source_xml name of the file with the original base XML document or fragment\n" +
"changed_xml name of the file with the changed XML document or fragment\n" +
"diffgram name of the file with file where the XDL diffgram will be stored (optional)\n\n" +
"Options:\n" +
"/o ignore child order\n" +
"/c ignore comments\n" +
"/p ignore processing instructions\n" +
"/w ignore whitespaces, normalize text value\n" +
"/n ignore namespaces\n" +
"/r ignore prefixes\n" +
"/x ignore XML declaration\n" +
"/d ignore DTD\n" +
"/f the files contain XML fragments\n" +
"/t use XmlDiffAlgorithm.Fast (walk-tree algorithm)\n" +
"/z use XmlDiffAlgorithm.Precise (tree-distance Zhang-Shasha algorithm)\n" +
"If no options specified, nothing above is ignored and the XmlDiff.exe will automatically determine the algorithm for you\n"
);
}
}
}
98 changes: 98 additions & 0 deletions tools/XmlDiffPatch/Samples/XmlDiff/XmlDiff.csproj
@@ -0,0 +1,98 @@
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.0.9466"
SchemaVersion = "1.0"
ProjectGuid = "{FAAA4719-071D-49A7-9A98-DDC2567747C9}"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "XmlDiff"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Exe"
RootNamespace = "XmlDiff"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "true"
Optimize = "false"
OutputPath = "bin\Debug\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "TRACE"
DocumentationFile = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuild = "false"
Optimize = "true"
OutputPath = "bin\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
HintPath = "..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.Xml"
HintPath = "..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
/>
<Reference
Name = "XmlDiffPatch"
AssemblyName = "XmlDiffPatch"
HintPath = "..\..\Bin\XmlDiffPatch.dll"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "AssemblyInfo.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Class1.cs"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>

0 comments on commit 7d126f3

Please sign in to comment.