472,145 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,145 software developers and data experts.

Loading dataset from XML

I had come across a code block from Loading a DataSet from XML (.NET
Framework Developer's Guide)
----------------------------------------
NOte If you call ReadXML to load a very large file, you may encounter slow
performance. To ensure best performance for ReadXml, on a large file, call
the DataTable.BeginLoadData method for each table in the DataSet, then call
ReadXml. Finally, call DataTable.EndLoadData for each table in the DataSet
as shown in the following example.

DataSet ds = new DataSet();

// How do I know how many table since I haven't load the XML data yet.
foreach(DataTable t in ds.Tables)
t.BeginLoadData();
ds.ReadXml("dotNET.xml");
// Here okay I may know how many table since I loaded the XML data.
foreach(DataTable t in ds.Tables)
t.EndLoadData();

How can this code improve reading large XML performance?
Cheers,
Kids
Nov 16 '05 #1
1 3023

"kids_pro" <ki******@yahoo.com> schrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP10.phx.gbl...
I had come across a code block from Loading a DataSet from XML (.NET
Framework Developer's Guide)
----------------------------------------
NOte If you call ReadXML to load a very large file, you may encounter slow
performance. To ensure best performance for ReadXml, on a large file, call
the DataTable.BeginLoadData method for each table in the DataSet, then call ReadXml. Finally, call DataTable.EndLoadData for each table in the DataSet
as shown in the following example.

DataSet ds = new DataSet();

// How do I know how many table since I haven't load the XML data yet.
ds.ReadXml("dotNET.xml",System.Data.XmlReadMode.Re adSchema);

foreach(DataTable t in ds.Tables)
t.BeginLoadData();
ds.ReadXml("dotNET.xml");
// Here okay I may know how many table since I loaded the XML data.
foreach(DataTable t in ds.Tables)
t.EndLoadData();

How can this code improve reading large XML performance?
Cheers,
Kids

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Patrick J. Schouten | last post: by
3 posts views Thread by Mauricio Correa L. | last post: by
4 posts views Thread by Fred Nelson | last post: by
reply views Thread by Chris | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.