开发者

Delay-load of XmlDocument

开发者 https://www.devze.com 2023-02-22 14:59 出处:网络
I\'m writing an XML document based on a stream of data. This part has been accomplished using the XmlTextWriter and the XElement classes.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消