创建一个编辑器来编辑大型xml文件 [英] create an editor to edit large xml files
问题描述
嗨
我想创建一个文本框来加载xml文件并让用户对其进行编辑.但是,由于文件可能很大,因此无法使用XmlDocument进行加载.我正在寻找以流方式/分块加载xml文档的选项,这样我就不会出现内存不足的情况 错误-同时,性能也很重要.您能告诉我什么是不错的选择吗?
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?
提前感谢您的帮助!
Smat
推荐答案
Streaming xml can be done using XmlReader.
但是,与文本文件不同,XML文件不容易块化". -对于给定的文件偏移量,任何XML读取器都必须读取到该点为止的整个文件,以便理解XML上下文.因此,您要尝试做的事情将非常困难.
However, unlike text files, XML files are not easily "chunkable" - for a given file offset, any XML reader will have to read the entire file up to that point in order to understand the XML context. So, what you're trying to do will be rather difficult.
-史蒂夫
-Steve
这篇关于创建一个编辑器来编辑大型xml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!