Shawn Sesna wrote:
Quote:
> The description of the XMLDocument.Load method doesn't quite answer the
> question. When passing in a FileStream object to the Load method, does it
> load the entire document into memory?
Yes. The kind of stream doesn't matter, actually, it will pull data from the
stream until it's read a complete document.
Quote:
> For example, if I have a 1 gigabyte file, would the Load method attempt
> read the entire 1 gigabyte file into memory when using a FileStream
> object?
It wouldn't actually read all of the file into memory, it would read it
piecewise and construct an in-memory representation of the XML document it
represents while it's doing so. This will end up quite a bit larger than 1
GB, actually. This is why XmlDocument is unsuitable for very large streams.
XmlReader and XPathNavigator are light-weight alternatives.
--
J.