Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Does the XMLDocument.Load(System.IO.Stream) method load the whole

Reply
 
Old 09-12-2008   #1 (permalink)
Shawn Sesna


 
 

Does the XMLDocument.Load(System.IO.Stream) method load the whole

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? 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?

My System SpecsSystem Spec
Old 09-12-2008   #2 (permalink)
Jeroen Mostert


 
 

Re: Does the XMLDocument.Load(System.IO.Stream) method load the whole

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.
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Windows Update Won't Load--gets error-"This page failed to load" Windows Updates
HELP! "Unable to load on Stream" Vista Games
CPU load about 50% when system is idle Vista General
how to reduce system load? Vista performance & maintenance
System Properties Fails To Load Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46