I would like to create a text box which loads xml files and let users edit them. However, I cannot use XmlDocument to load since the files can be very large. I am looking for options to stream/load the xml document in chunks so that I do not get out of memory errors -- at the same time, performance is important too. Could you let me know what would be good options?
Try Scintilla.NET, it is miles better than a TextBox!
http://scintillanet.codeplex.com/
Loading the document is easy:
using (TextReader reader = new StreamReader(myFilePath, Encoding.UTF8))
{
scintillaDocument.Text = reader.ReadToEnd();
}
Or:
scintillaDocument.Text = File.ReadAllText(myFilePath);
Why bother with reading the xml into an xmldocument at all if all you're doing is pushing it into a textbox?
How big are you talking about here? Have you tried streaming it into a textbox yet?
sometextarea.Text = System.IO.File.ReadAllText(Server.MapPath("somexml.xml"));
Now, saving it back to the filesystem is a different story, especially if you want it to be 1. Valid xml and 2. Valid against a schema.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With