Nick
Nick

Reputation: 25799

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 manual way using the XmlTextReader class.

Thanks.

Nick.

Upvotes: 1

Views: 192

Answers (3)

Bek Raupov
Bek Raupov

Reputation: 3777

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

Upvotes: 0

Daniel Hilgarth
Daniel Hilgarth

Reputation: 174329

This is not possible with either XmlDocument or XDocument.

Upvotes: 0

Aliostad
Aliostad

Reputation: 81660

Not possible with XmlDocument as the whole document needs to be loaded onto memory before parsed as tree.

XmlTextReader/SAX is the standard solution.

Upvotes: 3

Related Questions