I'm loading blobs out of a database as a byte array and I put them in a memory stream so that I can load them into an xmldocument for parsing.
However there are blobs that have multiple root nodes, this causes the parser to blow up.
My solution is to just make a new root node that encompasses the whole blob.
I can add onto the end just fine with a streamwriter however I can't figure out how to add onto the beginning.
How can I prepend to a stream?
Update
I was having too much trouble getting this to work. The "XML" I was extracting was not proper XML and I kept on having to add more and more regexes to remove bad XML before the XmlDocument Load. I ended up using the HtmlAgilityPack to parse out my valid sections of XML and I put those inside their own xml documents. Not the nicest solution but it works. Sigh