how to read xml in datatabl?
How to read the "Leg" nodes in this xml by datatable?
XmlTextReader textReader = new XmlTextReader("C:\\XMLFile1.xml");
DataTable dt = new DataTable();
DataSet ds = new DataSet();
ds.ReadXml("C:\\XMLFile1.xml");
dt = ds.Tables[0];
I follow http://www.c-sharpcorner.com/Forums/Thread/109386/xml-reading-problem-getting-error.aspx
but it read only the "ItemCount" .... not "Leg" Node
<?xml version="1.0"?>
<Reply>
<ShoppingBasketReply>
<ItemCount>1</ItemCount>
<FlightChoice>
<Leg>
<From>LCY</From>
<To>AMS</To>
<DepDate>Sun 27Feb11</DepDate>
<DepTime>17:50</DepTime>
<ArrDate>Sun 27Feb11</ArrDate>
<ArrTime>20:05</ArrTime>
<Carrier>KL</Carrier>
<FltNo>2760</FltNo>
<DepTerminal></DepTerminal>
<ArrTerminal></ArrTerminal>
<MealCode></MealCode>
<Equip>AR8</Equip>
<Miles> 217</Miles>
<Time> 1:15</Time>
<ItemFRef>7341854034027201</ItemFRef>
<Text> KL 2760 CITYJET</Text>
<LegType>1</LegType>
<Cabin>4</Cabin>
<Seats>3</Seats>
</Leg>
<Leg>
<From>AMS</From>
<To>CDG</To>
<DepDate>Sun 27Feb11</DepDate>
<DepTime>20:45</DepTime>
<ArrDate>Sun 27Feb11</ArrDate>
<ArrTime>22:00</ArrTime>
<Carrier>KL</Carrier>
<FltNo>2023</FltNo>
<DepTerminal></DepTerminal>
<ArrTerminal>2F</ArrTerminal>
<MealCode>M</MealCode>
<Equip>321</Equip>
<Miles> 247</Miles>
<Time> 1:15</Time>
<ItemFRef>7341854034027201</ItemFRef>
<Text> KL 2023 AIR FRANCE</Text>
<GroundTime> :40</GroundTime>
<LegType>1</LegType>
<Cabin>4</Cabin>
<Seats>9</Seats>
</Leg>
<Leg>
<From>CDG</From>
<To>AMS</To>
<DepDate>Thu 24Mar11</DepDate>
<DepTime>20:25</DepTime>
<ArrDate>Thu 24Mar11</ArrDate>
<ArrTime>21:40</ArrTime>
<Carrier>KL</Carrier>
<FltNo>1246</FltNo>
<DepTerminal>2F</DepTerminal>
<ArrTerminal></ArrTerminal>
<MealCode>M</MealCode>
<Equip>737</Equip>
<Miles> 247</Miles>
<Time> 1:15</Time>
<ItemFRef>7341854034027201</ItemFRef>
<LegType>2</LegType>
<Cabin>4</Cabin>
<Seats>9</Seats>
</Leg>
<Leg>
<From>AMS</From>
<To>LCY</To>
<DepDate>Fri 25Mar11</DepDate>
<DepTime>07:10</DepTime>
<ArrDate>Fri 25Mar11</ArrDate>
<ArrTime>07:20</ArrTime>
<Carrier>KL</Carrier>
<FltNo>2751</FltNo>
<DepTerminal></DepTerminal>
<ArrTerminal></ArrTerminal>
<MealCode></MealCode>
<Equip>AR8</Equip>
<Miles> 217</Miles>
<Time> 1:10</Time>
<ItemFRef>7341854034027201</ItemFRef>
<Text> KL 2751 CITYJET</Text>
<GroundTime> 9:30</GroundTime>
<LegType>2</LegType>
<Cabin>4</Cabin>
<Seats>6</Seats>
</Leg>
</FlightChoice>
<PricingInfo>
<No>1</No>
<Item>1 x Adult Ticket</Item>
<Price> 145.00</Price>
<Total>145.00</Total>
</PricingInfo>
<PricingInfo>
<No>1</No>
<Item>1 x Adult Airport Tax</Item>
<Price> 174.56</Price>
<Total>174.56</Total>
</PricingInfo>
<PricingInfo>
<No>1</No>
<Item>1 x Booking Fee</Item>
<Price>10.00</Price>
<Total>10.00</Total>
</PricingInfo>
<BookingInfo>
<Adults>1</Adults>
<Children>0</Children>
<Infants>0</Infants>
<ChildDOB>26031999</ChildDOB>
<InfantDOB>26032009</InfantDOB>
</BookingInfo>
<TotalPrice>329.56</TotalPrice>
</ShoppingBasketReply>
</Reply>