Groups | Blog | Home
all groups > dotnet xml > march 2007 >

dotnet xml : Fastest way to load an xml file into an array in .net


Jörgen Ahrens
3/8/2007 12:00:00 AM
Hi All

VS 2005 SP1 (C#, VB.NET)

I need the absolut fastest way of loading an xml-file of about 700KB into an
array.

I need to load about 1500 of those xml-Files into arrays on startup of my
application.
Therefore it needs to be as fast as possible.
Please also tell me if the xml structure can be improved.

the xml looks like:
y: Year
m: Month
h: Hour
value

<data>
<v y="1998" m="1" h="1">0.227777109151971</v>
<v y="1998" m="1" h="2">0.206573903224972</v>
<v y="1998" m="1" h="3">0.165140219440699</v>
<v y="1998" m="1" h="4">0.124293431158821</v>
<v y="1998" m="1" h="5">0.104002798378086</v>
<v y="1998" m="1" h="6">0.0812389501473294</v>
<v y="1998" m="1" h="7">0.0136806566150509</v>
<v y="1998" m="1" h="8">0.0607339108863059</v>
<v y="1998" m="1" h="9">0.111394621283997</v>
<v y="1998" m="1" h="10">0.168801709563907</v>
<v y="1998" m="1" h="11">0.0865607844888258</v>
<v y="1998" m="1" h="12">0.101389182210782</v>
<v y="1998" m="1" h="13">0.204044532248796</v>
<v y="1998" m="1" h="14">0.157314882488258</v>
<v y="1998" m="1" h="15">0.121055145349667</v>
<v y="1998" m="1" h="16">0.102359195578094</v>
<v y="1998" m="1" h="17">0.0199985034684297</v>
<v y="1998" m="1" h="18">0.107776377100517</v>
<v y="1998" m="1" h="19">0.140707273209167</v>
<v y="1998" m="1" h="20">0.116934362505389</v>
<v y="1998" m="1" h="21">0.181578399407852</v>
<v y="1998" m="1" h="22">0.162783178544661</v>
<v y="1998" m="1" h="23">0.248914944436437</v>
<v y="1998" m="1" h="24">0.201314812545552</v>
<v y="1998" m="2" h="1">0.169468199288149</v>
....
<v y="2050" m="12" h="24">-0.930491278500616</v>
</data>

Thanks for your help

jahrens

Martin Honnen
3/8/2007 12:00:00 AM
[quoted text, click to view]

Use XmlReader to pull in the data. Your code will need to push the data
the XmlReader delivers into an array.



--

Martin Honnen --- MVP XML
v-wywang NO[at]SPAM online.microsoft.com (
3/9/2007 12:00:00 AM

Yes, XmlReader provides fast, non-cached, forward-only access to XML data.

Hope this helps.
Sincerely,
Wen Yuan
v-wywang NO[at]SPAM online.microsoft.com (
3/13/2007 11:16:10 AM
Hi Jahrens,

Just want to check whether the issue has been resolved.
If you have met any further issue, please feel free to update.
I'm glad to assist you.

Have a great day,
Sincerely,
Wen Yuan
Jörgen Ahrens
3/15/2007 1:42:52 PM
Hi Wen Yuan

we changed everthing to a binary format...much faster and smaller.

thanks for the help anyway.
jahrens

[quoted text, click to view]

AddThis Social Bookmark Button