Yesterday I saw a link: an article on the MSDN on the Efficient Techniques for Modifying Large XML Files. Modifying the XML file, I have always been a headache event. When the XML file is large, the use of XMLDocument handling efficiency is very low, but this article has not given a satisfactory answer, and the full text tells two examples. : Feel the first example and interest: using XML's Inclusion concept to make the article to expand. He created two documents, the first is the XML document for the Well Format, the second is the XML reference document, the content is as follows:
Logfile.xml: XML Version = "1.0"?> ]>
Logfile-entries.txt:
Let's see it. This method handles Append is really great. But other forms of modifications are unable to force. The second part of the article, how to quickly retrieve and write data using XMLTextReader and XMLTextWriter, what he means to avoid using XMLDocument. In this example, he uses XMLNameTable, meaning the address is compared to a string comparison speed.
As follows: xmlnametable xnt = new name (); // xmlNameTable is an abstract class, nametable is a specific implementation. String ip = xnt.add ("ip"); XMLTextReader XR = New XMLTextReader (XNT); // Initialize XMLTextTable using XMLNameTable