locked
System.Xml.XmlDocument filenotfoundexception RRS feed

  • Question

  • Hi,

    While trying to compare two xmldocuments generated by serializing two entity collections using xmldiff tool, I am getting filenotfoundexception for System.Xml.XmlDocument. I have included system.xml as well as the xmldiff dll as a reference to the windows application project. Can you please help me out on this? 

    Thanks,

    Arvind

    Tuesday, October 1, 2013 9:14 AM

Answers

All replies

  • Can you share little more details or share portion of code snippet?

    Tuesday, October 1, 2013 9:18 AM
  • Hi Ravi,

    Here it is

        string xml1 = xmlDocument1.ToString();
                string xml2 = xmlDocument2.ToString();

                XmlWriter writer =  XmlWriter.Create("D:\\finalXml.xml");
                XmlDiff xmlDiff = new XmlDiff(XmlDiffOptions.IgnoreChildOrder | XmlDiffOptions.IgnoreComments | XmlDiffOptions.IgnoreWhitespace);

                xmlDiff.Compare(xml1, xml2, false, writer);

    getting the error at xmldiff.compare step
    • Edited by ArvindMB Tuesday, October 1, 2013 9:39 AM
    Tuesday, October 1, 2013 9:37 AM
  • Please ensure that at statement " XmlWriter writer =XmlWriter.Create("D:\\finalXml.xml");" whether file is getting created or not in "d:\\" drive. some times because of permissions file would have not created and then will cause to exception.

    for further reference you can refer following links.

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

    http://msdn.microsoft.com/en-us/library/aa302295.aspx#xmldif_topic4



    Tuesday, October 1, 2013 11:54 AM
  • Post the callstack.  You didn't post the code where you're opening the XML document.  Does the document have any XSD references and, if so, are you trying to validate the schema?

    Michael Taylor
    http://msmvps.com/blogs/p3net

    Friday, October 4, 2013 1:43 PM