Jun 9, 2010 at 5:30 PM
Edited Jun 10, 2010 at 12:33 PM
doc.OptionOutputAsXml = true;
using (var memoryStream = new MemoryStream())
memoryStream.Position = 0;
_xDocument = XDocument.Load(memoryStream, LoadOptions.None);
Exception when loading memorystream to xdocument (unclosed elements). Tryed to read memory stream to string - html is incomplete. So, I think in HtmlDocument.Save method internal stream doesn't get flushed or closed and that's why I get incomplete html document.
Maybe I incorrectly saving?