Hi Group,
The problem is solved :)
Following lines were creating the problem:
StreamWriter streamWriter = new StreamWriter(responseStream);
streamWriter.Write(responseXml); //responseXml is a string
The the default buffer of StreamWriter is 4kb and the string responseXml is more than that, thus only a portion of my xml was being used by XmlTextWriter which is using responseStream: And that was the reason of Unexpected end of file while parsing Name has occurred exception.
Solution:
Rather than using the the StreamWriter, I directly used the responseStream.Write; for this I converted the string to byte array. Following is the code for it.
String responseXml = GetResponseStream(uri, searchRequestXML);
System.Text.UTF8Encoding ob = new UTF8Encoding();
byte[] arr2 = ob.GetBytes(responseXml);
responseStream.Write(arr2,0,arr2.Length);
responseStream.Seek(0, SeekOrigin.Begin);
XmlTextReader xmlTextReader = new XmlTextReader(responseStream)
Well the conclusion is StreamWriter has a default size of 4KB which is not increased dynamically, and this is really unexpected.
Best Regards,
Anup Daware
Best Regards,
Anup
<Today is the first day of your rest of life.. Make most of it>
|