I am totally new to reading data from file, specially xml files.
I have a xml file in my bin\debug folder and the xml file looks something like this:
<Companies>
    <Company>
        <Name>Name1</Name><Code>11014</Code>    
        <MaintenancePercentage>15.9</MaintenancePercentage>
        <Sales>
            <Sale>
                <Code>19538</Code>
                <Title>ABC</Title>
                <Date>2009-04-29T00:00:00</Date>
                <Category>Category1</Category>
                <Amount>6543.39</Amount>
            </Sale>
            <Sale>
                <Code>19539</Code>
                <Title>xyz</Title>
                <Date>2009-04-30T00:00:00</Date>
                <Category>Category2</Category>
                <Amount>654.39</Amount>
            </Sale>
        </Sales>
    </Company>
    <Company>
        <Name>Name1</Name><Code>11014</Code>     
        <MaintenancePercentage>15.9</MaintenancePercentage>
        <Sales>
            <Sale>
                <Code>19538</Code>
                <Title>ABC</Title>
                <Date>2009-04-29T00:00:00</Date>
                <Category>Category1</Category>
                <Amount>6543.39</Amount>
            </Sale>
            <Sale>
                <Code>19539</Code>
                <Title>xyz</Title>
                <Date>2009-04-30T00:00:00</Date>
                <Category>Category2</Category>
                <Amount>654.39</Amount>
            </Sale>
        </Sales>
    </Company>
</Companies>
This are my classes:
public class Company
{
    public string Name;
    public string Code;
    public double MaintenancePercentage;
    public double AverageSales;
    public double TotalSales;
    public double TotalMaintenanceFee;
    public List<Sales> Saleses;
}
public class Sales
{
    public string Code;
    public string Title;
    public DateTime DateTime;
    public string Category;
    public double Amount;
}
Now from the xml file I want to read the data and store them.
How can I read the values from the xml files?
For example
var company = new Company();
company.Name = //name from xml file
//and so on
foreach(sales in company)
{
   sales.code = //code from xml file
   sales.title = //title from xml file
   //and so on
}
This is what I've done so far using search results from google, but I don't know what to do now
var doc = new XmlDocument();
doc.Load(@"export.xml");
var root = doc.DocumentElement;
if (root == null)
{
    return;
}
var company = root.SelectNodes("Company");
if (company == null)
{
    return;
}
else
{
    foreach (var companyData in company)
    {
        var title = 
    }
}
This last piece of code makes any sense at least?
 
     
     
    