I wondering about sense of using XmlDocument class to processing a small XML files.
If during the XML file is loading, XmlDocument creates a whole set of object-oriented structure for all XML elements and their relationship, theoretically for small xml files, there is a slight performance decrease and resources consumption and in the same time, we have clear and easy data management.
I read many articles about the processing of XML files – usualy people suggest using lightweight solutions like XmlTextReader instead XmlDocument for fast forward reading – even for small files. Am I wrong or XmlDocument is not so bad?
You will have to measure it, but even for a small file the I/O will be the main factor.
And how do you want to use the file? That is far more important.
I would never consider an Xml(Text)Reader for small files. The only thing it would optimize is memory usage.
In reply to the comment:
For 100kB, just use XDocument or the older XmlDocument
You can get all your nodes with XElement.Descendants(“TAG”)