Improving performances reading a XML into a DataSet

  • Thread starter Thread starter Dev
  • Start date Start date
D

Dev

Good Morning to all,

I have a bunch of XML files that need to be readed inside the same DataSet
(each XML represent a single table).

In the event of a large (some megabytes) file, what is the best practice to
read them into the DataSet via the ReadXML() method?

Thanks, sorry for my newbie-hood

Dev
 
Dev,

There really isn't more than one way to do this. You are going to get
the best performance by using the ReadXml method, which uses streams and/or
readers to read the data. That's the best you could do.

Unless you need to keep all of this in memory, you might want to look at
processing the stream using an XmlReader. This would avoid all that
overhead of keeping it in memory.

Hope this helps.
 
Hi,

If I use DataSet.ReadXML() specifyng a XmlReader as parameter, when I cycle
through the rows of the table in dataset is guaranteed that the XML is not
all in memory?

Thanks

Dev


Nicholas Paldino said:
Dev,

There really isn't more than one way to do this. You are going to get
the best performance by using the ReadXml method, which uses streams and/or
readers to read the data. That's the best you could do.

Unless you need to keep all of this in memory, you might want to look at
processing the stream using an XmlReader. This would avoid all that
overhead of keeping it in memory.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Dev said:
Good Morning to all,

I have a bunch of XML files that need to be readed inside the same DataSet
(each XML represent a single table).

In the event of a large (some megabytes) file, what is the best practice to
read them into the DataSet via the ReadXML() method?

Thanks, sorry for my newbie-hood

Dev
 
Dev,

Well, it guarantees that the XmlDocument isn't loaded into memory.
However, you are loading into the dataset, and eventually, the memory taken
up by that will be related to the memory of the data set (not completely, as
the dataset has a different internal structure than the DOM, but I would
think there is some relation).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Dev said:
Hi,

If I use DataSet.ReadXML() specifyng a XmlReader as parameter, when I cycle
through the rows of the table in dataset is guaranteed that the XML is not
all in memory?

Thanks

Dev


Nicholas Paldino said:
Dev,

There really isn't more than one way to do this. You are going to get
the best performance by using the ReadXml method, which uses streams and/or
readers to read the data. That's the best you could do.

Unless you need to keep all of this in memory, you might want to
look
at
processing the stream using an XmlReader. This would avoid all that
overhead of keeping it in memory.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Dev said:
Good Morning to all,

I have a bunch of XML files that need to be readed inside the same DataSet
(each XML represent a single table).

In the event of a large (some megabytes) file, what is the best
practice
to
read them into the DataSet via the ReadXML() method?

Thanks, sorry for my newbie-hood

Dev
 

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