// Simple Example of using LINQ 2 XML to Parse XML Data Entries into C# Objects
// Author: Sergey Berezovskiy
// Source: http://stackoverflow.com/questions/14226473/c-sharp-parsing-xml-file
// NOTE: Your XML file should have a single root node
var xdoc = XDocument.Load(path_to_xml);
var entries = from e in xdoc.Descendants("entry")
select new {
Id = (int)e.Attribute("id"),
Type = (string)e.Attribute("type"),
Name = (string)e.Element("name"),
Description = (string)e.Element("description")
};
// The above Query will return sequence of anonymous objects corresponding to each
// entry element (with properties Id, Type, Name, and Description).