I've been trying to read in this XML file ( in the link below) into my class that I've created. but had no luck. Anyone got any ideas ? I have this xml file that is consist of food items each food item is consist of country, id, name, and description, category, and price. I've also created a class called data the is a parent to items to hold the data once I read in the data from the xml file. I am not very experienced in xml. If you guys could help me out. i would be very thankful
// Here is my XML
//http://i62.tinypic.com/2r4mwzb.jpg
public class Items{ //The class I've created to hold the data from xml
public string country {get;set;}
public int id { get; set; }
public string name { get; set; }
public string description { get; set; }
public string category { get; set; }
public float price { get; set; }
public void print(){
Console.WriteLine("Country: " + country);
Console.WriteLine("id: "+ id);
Console.WriteLine("description: "+ description);
Console.WriteLine("category: " + category);
Console.WriteLine("Price: " + price);
}
}
public class Data{ // Items is a child class of Data
public Items [] FoodItemData;
}
public class Program
{
static void Main(string[] args)
{
XmlTextReader reader = new XmlTextReader("FoodItemData.xml");
Console.ReadLine();
}
}