TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Vikas Ahlawat
NA
564
818k
Please tell me the = best Way to read XML, and store it in datatable(C#,Asp.net).
Feb 21 2011 1:15 AM
Hi i got the following XML
<Leg>
<From>LCY</From>
<To>AMS</To>
<DepDate>Sun 27Feb11</DepDate>
<DepTime>17:50</DepTime>
<MealCode></MealCode>
<Equip>AR8</Equip>
<Miles> 217</Miles>
<Time> 1:15</Time>
<ItemFRef>734185403402799</ItemFRef>
<Text> KL 2760 CITYJET</Text>
<LegType>1</LegType>
</Leg>
<Leg>
<From>AMS</From>
<To>CDG</To>
<DepDate>Sun 27Feb11</DepDate>
<DepTime>20:45</DepTime>
<MealCode>M</MealCode>
<Equip>321</Equip>
<Miles> 247</Miles>
<Time> 1:15</Time>
<ItemFRef>734185403402799</ItemFRef>
<Text> KL 2023 AIR FRANCE</Text>
<GroundTime> :40</GroundTime>
<LegType>1</LegType>
</Leg>
<Leg>
<From>CDG</From>
<To>AMS</To>
<DepDate>Thu 24Mar11</DepDate>
<DepTime>20:25</DepTime>
<MealCode>M</MealCode>
<Equip>737</Equip>
<Miles> 247</Miles>
<Time> 1:15</Time>
<ItemFRef>734185403402799</ItemFRef>
<LegType>2</LegType>
</Leg>
For store this in datatable i am using following strategies
//Code in sort form.....
xmldoc1.LoadXml(responseFromServer1); // I got the above XML here
XmlNodeList leg = xmldoc1.GetElementsByTagName("Leg");
for (int i = 0; i < leg.Count; i++)
{
for(...........
.................
dr1["From"] = leg[i].ChildNodes[0].InnerText.ToString(); // here i m storing the value of node in datatable
...............
...............
}
but I think it is not good code.
Can any one tell me the bast way to achieve my goal?
Reply
Answers (
2
)
WebBrowser Control - Cycle through pages ... Help understanding
[WINFORM] Scroll partially visible when window loads