Delay-load of XmlDocument
I'm writing an XML document based on a stream of data. This part has been accomplished using the XmlTextWriter
and the XElement
classes.
Now when I come to read in the document I want to be able to 'delay-load' the XML document so that certain nodes are skipped (i.e. the ones which contain large binary chunks.) and then load them when required.
Is this possible using the XmlDocument
class? Or will I have to do things in a more manu开发者_Python百科al way using the XmlTextReader
class.
Thanks.
Nick.
Not possible with XmlDocument
as the whole document needs to be loaded onto memory before parsed as tree.
XmlTextReader/SAX is the standard solution.
This is not possible with either XmlDocument
or XDocument
.
note that if you want to use XmlTextReader, it is fwd only. i.e. once youhave skipped it, you cant come back to it.
see MSDN on this
精彩评论