I'm developing a blogging engine in ASP.NET and one the repositories is implemented to use XML files as the data store. the XML repository will mainly be used for local use and testing purposes. now although it might not be that of an issue with today's computers which have lots of memory available and processing power, but nevertheless I wanted to know some specific details :
- XPathDocument is a read-only document whereas the XmlDocument is a read/write document. Hence, is XPathDocument more lightweight than XmlDocument since it lacks the writing capabilities?
- I know for sure that when you load an XML document with XmlDocument it loads the entire document in memory, that might be a problem if the document size is big. Does XPathDocument do the same thing? if so, how can I read a single node or a set of nodes from an XML document without loading the entire document in memory first? I know I can use XmlTextReader but that means I have to parse the entire document as I access the nodes sequentially. I want to be able to query XML documents with an XPath expression.
Anyway, if the size of the object graphs don't differ much (XmlDocument and XPathDocument) it won't hurt to just get the job done, but I want to implement the best possible solution here.