Data from XML to Dataset in C#

Hi,
Here i will code you how to copy the data from XML file to DataSet or DataTable Using C# in .Net. XML File Should be in the below format as Shown below., here am calling ReadXML() function for binding XML Data into DataSet or DataTable.




C# Code

       protected void Page_Load(object sender, EventArgs e)
        {
            DataSet Ds = new DataSet();
            Ds = ReadXML();
        }
        public DataSet ReadXML()
        {
            string filePath = "D:\\Self Practice\\Sol1\\Sol1\\Information.xml";
            DataSet ds = new DataSet();
            ds.ReadXml(filePath);
            return ds;

        }

XML FIle

<?xml version="1.0" encoding="utf-8" ?>
<TableNames>
  <key id="001">
    <value>Brinjal</value>
    <price>100</price>
    <location>India</location>
    <season>spring</season>
  </key>
  <key id="002">
    <value>Potato</value>
    <price>150</price>
    <location>USA</location>
    <season>Summer</season>
  </key>
  <key id="003">
    <value>tomato</value>
    <price>50</price>
    <location>UK</location>
    <season>Fall</season>
  </key>

  <key id="004">
    <value>carrot</value>
    <price>20</price>
    <location>France</location>
    <season>spring</season>
  </key>

  <key id="005">
    <value>Onion</value>
    <price>300</price>
    <location>japan</location>
    <season>Holiday</season>
  </key>

  <key id="006">
    <value>Beans</value>
    <price>40</price>
    <location>China</location>
    <season>Fall</season>
  </key>

  <key id="007">
    <value>Drum Stick</value>
    <price>10</price>
    <location>london</location>
    <season>Summer</season>
  </key>
</TableNames>