Convert xml string to dataset

The below code will convert the XML of countries and its cities to dataset.


string xmlstring = @"<countries> <country name='India'> <city>Delhi</city> <city>Mumbai</city> <city>Hyderabad</city> </country> <country name='Australia'> <city>Sydney</city> <city>Hobart</city> <city>Canberra</city> </country> <country name='Canada'> <city>Toronto</city> <city>Niagara</city> <city>Victoria</city> </country> <country name='USA'> <city>Dallas</city> <city>Washington</city> <city>Chicago</city> </country> </countries>"; System.Data.DataSet ds = new System.Data.DataSet(); ds.ReadXml(new System.IO.StringReader(xmlstring));


Output DataSet: