Save all xml nodes to db without looping through it
- by AndreMiranda
I have this xml:
<Path>
<Record>
<ID>6534808</ID>
<Distance>1.05553036073736</Distance>
</Record>
<Record>
<ID>6542471</ID>
<Distance>1.05553036073736</Distance>
</Record>
... and about more 500 nodes
</Path>
And I'm using the code below to get all "Record" nodes:
XmlNodeList paths = xDoc.SelectNodes("//Record");
And, after that, I save each record to database. But, the problem is that I'm using a foreach to loop through this nodes and the count of this nodes may be more than 500, sometimes it gets up to 1000 "Records" node. And this gets too long...
Is there a way to save all of these nodes without looping through it?
Thanks!!