0

I installed the xml file comparer tool from this link :

http://msdn.microsoft.com/en-us/library/aa302294.aspx

and add the dll to my project and created this application :

Default.aspx:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Literal ID="Literal1" runat="server" Mode="Encode"></asp:Literal>&nbsp;</div>
    </form>
</body>
</html>

Default.aspx.cs :

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.XmlDiffPatch;
using System.Xml;
using System.IO;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        XmlDocument doc1 = new XmlDocument();
        doc1.Load(Server.MapPath("xmlfiles/deneme.xml"));
        XmlDocument doc2 = new XmlDocument();
        doc2.Load(Server.MapPath("xmlfiles/deneme2.xml"));
        StringWriter sw = new StringWriter();
        StringWriter sw2 = new StringWriter();
        StringWriter sw3 = new StringWriter();
        XmlTextWriter writer = new XmlTextWriter(sw);
        XmlTextWriter writer2 = new XmlTextWriter(sw2);
        XmlTextWriter gramwriter = new XmlTextWriter(sw3);
        doc2.WriteTo(writer2);
        doc1.WriteTo(writer);
        GenerateDiffGram(sw.ToString(), sw2.ToString(), gramwriter);
      //Literal1.Text = sw3.ToString();
       
       
    }
    public void GenerateDiffGram(string originalFile, string finalFile,
                                    XmlWriter diffGramWriter)
    {
        XmlDiff xmldiff = new XmlDiff(XmlDiffOptions.IgnoreChildOrder |
                                         XmlDiffOptions.IgnoreNamespaces |
                                         XmlDiffOptions.IgnorePrefixes);
        bool bIdentical = xmldiff.Compare(originalFile, finalFile, false, diffGramWriter);
        diffGramWriter.Close();
    }

}

it generates this error:

Invalid URI: The Uri string is too long

Do you have any idea why?

3
Contributors
5
Replies
6
Views
8 Years
Discussion Span
Last Post by LizR
0

Anyway guys i dont want to think about that problem anymore, i am trying to compare two xml files which dont have xsd. I tried to use that tool from microsoft but they didnt even bother to correct typos on the sample code, so anyway, thanks for the replies..

0

The reason the value was relevant is that was probably the URI it complained on.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.