Last post May 30, 2011 10:13 PM by Decker Dong - MSFT
May 28, 2011 04:46 AM|stevex33|LINK
I've managed to create an xml document, save it and then retrieve and display it in the browser all within .NET.
However, what I would like to do is rather than save the xml document to a file on disc, only to retrieve and subsequently delete it a fraction of a second later, I would like to store the xml document in memory and display it in the same way.
Can somebody please explan the "how to store and display the xml file in memory" component please.
I'm currently using the following to create the xmltextwriter: (Outputpath is just a string)
XmlTextWriter writer = new XmlTextWriter(outputPath, Encoding.UTF8);
May 28, 2011 12:27 PM|Knecke|LINK
XmlTextWriter takes a Stream in the constructor. Create a new System.IO.MemoryStream and pass that into the XmlTextWriter instead. Or if you want to output it directly to the browser you can use the Response.OutputStream
May 28, 2011 01:32 PM|Shakti Singh Tanwar|LINK
MemoryStream stream =
May 30, 2011 10:13 PM|Decker Dong - MSFT|LINK
1) In fact you can store your xml contents with XDocument.Load("xxx.xml"). And at that time, the whole xml contents will be saved in the memory. And you can just output it directly by using
2) To make it easier to deal with, and if your xml contents are smarter and brilliant, I think you can save your xml contents into the DataSet in the formation of DataTable. Then you can bind it to the GridView and do something like adding, deleting and
updating its values easily.
If you would like to see sample 2, I'd like to share you a nice sample. (Please send to
firstname.lastname@example.org, and with the title——CRUD with xml contents in GridView)