I have run into the same problem. The workaround I am using is to place the
XML in a file. The other methods listed below are things I tried that didn't
work.
// File IO overhead
string tempUrl = @"C:\temp\docs\temp.xml";
FileInfo tempFile = new FileInfo(tempUrl);
if (tempFile.Exists)
{
tempFile.Delete();
}
StreamWriter writer = new StreamWriter(tempFile.OpenWrite());
writer.Write(splitDocument.DocumentXmlString);
writer.Close();
this.webBrowser1.Url = tempUrl;
//Won't format
//MemoryStream temp = new MemoryStream();
//StreamWriter writer = new StreamWriter(temp);
//writer.Write(splitDocument.DocumentXmlString);
//writer.Flush();
//temp.Position = 0;
//this.webBrowser1.DocumentStream = temp;
// Won't format
//Encoder utf8encoder = Encoding.UTF8.GetEncoder();
//char[] charArray = splitDocument.DocumentXmlString.ToCharArray();
//byte[] byteArray = new byte[utf8encoder.GetByteCount(charArray, 0,
byteArray.Length, true)];
//int charsUsed;
//int bytesUsed;
//bool completed;
//utf8encoder.Convert(charArray, 0, charArray.Length, byteArray, 0,
byteArray.Length, true,
// out charsUsed, out bytesUsed, out completed);
//this.webBrowser1.DocumentStream = new MemoryStream(byteArray);