xml queston

  • Thread starter Thread starter Analizer1
  • Start date Start date
A

Analizer1

hi all
I have some pretty large XML Files
was wondering does dot net XML
do any buffering or does it just load the complete document into memory

tks
 
That depends on how you choose to read the file. If you choose to use the
XmlTextReader it will read the file as you go. However, it's forward only
traversal. If you use XmlDocument it will allow you to read & write and
move in both directions. However, it does it at the cost of using more
memory. I don't know if XmlDocument loads the entire file in to memory or
not. However, if it's writing it would pretty much have to.

This article does a pretty good job of covering the different methods and
their pros and cons.

http://support.softartisans.com/kbview.aspx?ID=673
 
in this case
1. Generate a xml document from Result sets
once this file is generated.
2. Run through a Xsl to another XML

the final step..i only Need to Read the xml and traverse it
to generate a final Special formatted Text File

so would XmlReader be better fit for this , instead of
XMLDocument


Andrew Faust said:
That depends on how you choose to read the file. If you choose to use the
XmlTextReader it will read the file as you go. However, it's forward only
traversal. If you use XmlDocument it will allow you to read & write and
move in both directions. However, it does it at the cost of using more
memory. I don't know if XmlDocument loads the entire file in to memory or
not. However, if it's writing it would pretty much have to.

This article does a pretty good job of covering the different methods and
their pros and cons.

http://support.softartisans.com/kbview.aspx?ID=673

--
Andrew Faust
andrew[at]andrewfaust.com
http://www.andrewfaust.com


Analizer1 said:
hi all
I have some pretty large XML Files
was wondering does dot net XML
do any buffering or does it just load the complete document into memory

tks
 
1. Generate a xml document from Result sets
Better yet, use ExecuteReader/ExecuteXmlReader. The former is simpler
for flat data-structures; the latter is usable for structured data -
but in both cases are streaming.
once this file is generated.
2. Run through a Xsl to another XML
the final step..i only Need to Read the xml and traverse it
to generate a final Special formatted Text File
You'd need to do some digging to figure out if the Xsl processor is
loading a dom internally - it might even depend on which axes you use
in the xslt, but my worst-case assumption would be that it loads
everything. If your output format is simple, it might be better to
simply walk the IDataReader/XmlReader manually to build the output. Or
for xml consider using LINQ-to-xml (which will be RTM in a few weeks)
[although I haven't done much playing with this yet; I can't say
whether it streams or uses a DOM].

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top