If I do
XPathDocument doc = new XPathDocument("filename.xml");
Does that load the entire document into memory? I'm writing a mobile phone app and the document might store lots of data that doesn't ever need to all be loaded at the same time. Mobile phones don't usually have too much ram!
Yes, the whole XML document is represented in memory.
One solution is to split a large XML document into many smaller ones.
Or, alternatively, you may write your own XmlReader
that will ignore unwanted subtrees. You can pass this XmlReader
as argument to the XpathDocument()
constructor -- need to camouflage it as TextReader
.
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