0
XmlDocument xmlDoc = new XmlDocument();xmlDoc.Load(responsedata);

It's give exception: System.UriFormatException: Invalid URI: The Uri string is too long.

Vishal Suthar
  • 17,013
  • 3
  • 59
  • 105
user1716958
  • 11
  • 1
  • 1
  • Have a look at http://stackoverflow.com/questions/7043566/invalid-uri-the-uri-string-is-too-long to see if that gives you insight in the problem at hand. – Tobias Nilsson Jan 07 '13 at 08:16

3 Answers3

4

xmlDoc.Load expects a URL not the file itsself. That's why it is telling that. It expects a normal URI but you hand it a big file...

http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.load.aspx

erichste
  • 759
  • 4
  • 16
3

I believe there is an assumption that responsedata holds a value pointing to an xml file to read in, i.e. "c:\temp\sometest.xml".

From your case, however, it appears that the responedata is a stream you received from a Web Service request. If this is the case, the try the following:

XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(responsedata);

HTH

1

Update your code to use the newer XDocument class, and call XDocument.Parse.

Hanno
  • 1,017
  • 11
  • 18