Microsoft差分およびパッチGUIツールを使用しようとしています。ステートメントdv.loadを実行している間、私はエラーを取得:missing options attributediffgramの 'options'属性がありません。 Microsoft DiffAndPatch GUIツール
タイプの未処理の例外 'のSystem.Exception' のXmlDiffPatch.View.dll
Additional information: Missing 'options' attribute in the diffgram.
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Xml;
using Microsoft.XmlDiffPatch;
using System.Xml.Linq;
using System.Collections.Generic;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string oldxml = "<form><tabs><tab name=\"general\" verticallayout=\"true\" id=\"{5eb9e7cf-effa-4732-bfeb-d482b5652520}\" IsUserDefined=\"0\"><columns><column width=\"25%\"><sections><section name=\"ColorStrip\" showlabel=\"false\" showbar=\"false\" columns=\"1\" IsUserDefined=\"0\" id=\"{7fdcb32a-3e98-40ab-aeda-cf521f77c2de}\"></section></sections></column><column width=\"75%\"><sections><section name=\"CardHeader\" showlabel=\"false\" showbar=\"false\" columns=\"111\" id=\"{0ff9556b-e42d-4cd4-829c-d8e6113a5064}\" IsUserDefined=\"0\"><rows><row><cell id=\"{2506b8ee-4e32-424c-a032-7c9b95d70721}\" showlabel=\"true\" locklevel=\"0\"><control id=\"statuscode\" classid=\"{5D68B988-0661-4db2-BC3E-17598AD3BE6C}\" datafieldname=\"statuscode\" disabled=\"false\" /></cell><cell id=\"{c86dbf55-72ee-4ff8-8d57-5ca6377bc397}\" showlabel=\"true\" locklevel=\"0\"></cell><cell id=\"{984dd953-3556-4de4-9505-40fd1358007e}\" showlabel=\"true\" locklevel=\"0\"></cell></row></rows></section><section name=\"CardDetails\" showlabel=\"false\" showbar=\"false\" columns=\"1\" id=\"{100e61a9-6a57-4f32-9385-214d88dcc782}\" IsUserDefined=\"0\"><rows><row><cell id=\"{848b1cf6-075c-4dc7-b6d8-e1bf5e8be223}\" showlabel=\"true\" locklevel=\"0\"><control id=\"new_name\" classid=\"{4273EDBD-AC1D-40d3-9FB2-095C621B552D}\" datafieldname=\"new_name\" disabled=\"false\" /></cell></row></rows></section><section name=\"CardFooter\" showlabel=\"false\" columns=\"1111\" showbar=\"false\" id=\"{52ff4be4-8e82-47f8-9fee-0148c7807eeb}\" IsUserDefined=\"0\"><rows><row><cell id=\"{81f56aad-9280-40ff-988a-77788ec5d9c6}\" showlabel=\"true\" locklevel=\"0\"><control id=\"ownerid\" classid=\"{270BD3DB-D9AF-4782-9025-509E298DEC0A}\" datafieldname=\"ownerid\" disabled=\"false\" /></cell><cell id=\"{4b0c5a03-c268-4da4-88fa-9651543454f1}\" showlabel=\"true\" locklevel=\"0\"><control id=\"createdon\" classid=\"{270BD3DB-D9AF-4782-9025-509E298DEC0A}\" datafieldname=\"createdon\" disabled=\"false\" /></cell><cell id=\"{46d0c273-fd3c-4e31-a790-40ae6fe58af0}\" showlabel=\"true\" locklevel=\"0\"></cell><cell id=\"{ed31d13f-f917-4cdd-827f-425aa481ea00}\" showlabel=\"true\" locklevel=\"0\"></cell></row></rows></section></sections></column></columns></tab></tabs></form>";
string newxml = "<form><tabs><tab name=\"general\" verticallayout=\"true\" id=\"{5eb9e7cf-effa-4732-bfeb-d482b5652520}\" IsUserDefined=\"0\"><columns><column width=\"25%\"><sections><section name=\"ColorStrip\" showlabel=\"false\" showbar=\"false\" columns=\"1\" IsUserDefined=\"0\" id=\"{7fdcb32a-3e98-40ab-aeda-cf521f77c2de}\"></section></sections></column><column width=\"75%\"><sections><section name=\"CardHeader\" showlabel=\"false\" showbar=\"false\" columns=\"111\" id=\"{0ff9556b-e42d-4cd4-829c-d8e6113a5064}\" IsUserDefined=\"0\"><rows><row><cell id=\"{2506b8ee-4e32-424c-a032-7c9b95d70721}\" showlabel=\"true\" locklevel=\"0\"><control id=\"statuscode\" classid=\"{5D68B988-0661-4db2-BC3E-17598AD3BE6C}\" datafieldname=\"statuscode\" disabled=\"false\" /></cell><cell id=\"{c86dbf55-72ee-4ff8-8d57-5ca6377bc397}\" showlabel=\"true\" locklevel=\"0\"></cell><cell id=\"{984dd953-3556-4de4-9505-40fd1358007e}\" showlabel=\"true\" locklevel=\"0\"></cell></row></rows></section><section name=\"CardDetails\" showlabel=\"false\" showbar=\"false\" columns=\"1\" id=\"{100e61a9-6a57-4f32-9385-214d88dcc782}\" IsUserDefined=\"0\"><rows><row><cell id=\"{848b1cf6-075c-4dc7-b6d8-e1bf5e8be223}\" showlabel=\"true\" locklevel=\"0\"><control id=\"new_name\" classid=\"{4273EDBD-AC1D-40d3-9FB2-095C621B552D}\" datafieldname=\"new_name\" disabled=\"false\" /></cell></row></rows></section><section name=\"CardFooter\" showlabel=\"false\" columns=\"1111\" showbar=\"false\" id=\"{52ff4be4-8e82-47f8-9fee-0148c7807eeb}\" IsUserDefined=\"0\"><rows><row><cell id=\"{81f56aad-9280-40ff-988a-77788ec5d9c6}\" showlabel=\"true\" locklevel=\"0\"><control id=\"ownerid\" classid=\"{270BD3DB-D9AF-4782-9025-509E298DEC0A}\" datafieldname=\"ownerid\" disabled=\"false\" /></cell><cell id=\"{4b0c5a03-c268-4da4-88fa-9651543454f1}\" showlabel=\"true\" locklevel=\"0\"><control id=\"createdon\" classid=\"{270BD3DB-D9AF-4782-9025-509E298DEC0A}\" datafieldname=\"createdon\" disabled=\"false\" /></cell><cell id=\"{46d0c273-fd3c-4e31-a790-40ae6fe58af0}\" showlabel=\"true\" locklevel=\"0\"></cell></row></rows></section></sections></column></columns></tab></tabs></form>";
List<char> list1 = new List<char>();
List<char> list2 = new List<char>();
XmlDiff diff = new XmlDiff();
XmlDiffOptions diffOptions = new XmlDiffOptions();
diffOptions = XmlDiffOptions.None;
//Read the options settings and OR the XmlDiffOptions enumeration.
diffOptions = diffOptions | XmlDiffOptions.IgnorePI;
diffOptions = diffOptions | XmlDiffOptions.IgnoreChildOrder;
diffOptions = diffOptions | XmlDiffOptions.IgnoreComments;
diffOptions = diffOptions | XmlDiffOptions.IgnoreDtd;
diffOptions = diffOptions | XmlDiffOptions.IgnoreNamespaces;
diffOptions = diffOptions | XmlDiffOptions.IgnorePrefixes;
diffOptions = diffOptions | XmlDiffOptions.IgnoreWhitespace;
diffOptions = diffOptions | XmlDiffOptions.IgnoreXmlDecl;
diff.Algorithm = XmlDiffAlgorithm.Auto;
diff.Options = diffOptions;
for (int i = 0; i < oldxml.Length; i++)
{
if (oldxml[i] == '\\' && oldxml[i] == '\"')
{
list1.Add('"');
i++;
}
else
{
list1.Add(oldxml[i]);
}
}
for (int i = 0; i < newxml.Length; i++)
{
if (newxml[i] == '\\' && newxml[i] == '\"')
{
list2.Add('"');
i++;
}
else
{
list2.Add(newxml[i]);
}
}
string xml1 = string.Join("", list1.ToArray());
string xml2 = string.Join("", list2.ToArray());
XmlReader node1 = XElement.Parse(xml1).CreateReader();
XmlReader node2 = XElement.Parse(xml2).CreateReader();
bool compareFragments = true;
var result = new XDocument();
var writer = result.CreateWriter();
bool isEqual = false;
try
{
isEqual = diff.Compare(node1, node2, writer);
}
catch (XmlException xe)
{
MessageBox.Show("An exception occured while comparing\n" + xe.StackTrace);
}
writer.Flush(); writer.Close();
if (isEqual)
{
//This means the files were identical for given options.
Console.Write("Files Identical for the given options");
return; //dont need to show the differences.
}
XmlDiffView dv = new XmlDiffView();
XmlTextReader old = new XmlTextReader(new System.IO.StringReader(xml1));
old.Read();
XmlTextReader dif = new XmlTextReader(new System.IO.StringReader(xml2));
dif.Read();
//Load the original file again and the diff file.
dv.Load(old,dif);
//Wrap the HTML file with necessary html and
//body tags and prepare it before passing it to the GetHtml method.
string tempFile = "abc.htm";
StreamWriter sw1 = new StreamWriter(tempFile);
sw1.Write("<html><body><table width='100%'>");
//Write Legend.
sw1.Write("<tr><td colspan='2' align='center'><b>Legend:</b> <font style='background-color: yellow'" +
" color='black'>added</font> <font style='background-color: red'" +
" color='black'>removed</font> <font style='background-color: " +
"lightgreen' color='black'>changed</font> " +
"<font style='background-color: red' color='blue'>moved from</font>" +
" <font style='background-color: yellow' color='blue'>moved to" +
"</font> <font style='background-color: white' color='#AAAAAA'>" +
"ignored</font></td></tr>");
sw1.Write("<tr><td><b> File Name : ");
sw1.Write("1");
sw1.Write("</b></td><td><b> File Name : ");
sw1.Write("2");
sw1.Write("</b></td></tr>");
//This gets the differences but just has the
//rows and columns of an HTML table
dv.GetHtml(sw1);
//Finish wrapping up the generated HTML and complete the file.
sw1.Write("</table></body></html>");
//HouseKeeping...close everything we dont want to lock.
sw1.Close();
dv = null;
old.Close();
dif.Close();
}
}
}
どのような行がエラーを起こしますか? –