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 :
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.
XmlDocument is very easy to use. Its only real drawback is that it loads the whole XML document into memory to process. Its seductively simple to use. XmlReader is a stream based reader so will keep your process memory utilization generally flatter but is more difficult to use.
An XML document is a basic unit of XML information composed of elements and other markup in an orderly package. An XML document can contains wide variety of data. For example, database of numbers, numbers representing molecular structure or a mathematical equation.
XPathDocument reads the complete document into memory as well, that is needed to support all the XPath axes like preceding-sibling, preceding, ancestor, parent, child, descendant, following-sibling, following.
If you want to do XPath or XQuery queries without loading the whole document into memory then you have to look into specialized XML databases or at least into SQL databases with an XML data type with XQuery support. MS SQL server for instance has an XML data type and supports some (in my view rather limited) version of XQuery on that.
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