using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using System.Text;
class Program
{
static void Main(string[] args)
{
string xmlFileName = "e.xml";
XDocument customers = XDocument.Load(xmlFileName);
var queryResults =
from c in customers.Descendants("order").Attributes("orderYear")
select c.Value;
foreach (var item in queryResults)
{
Console.WriteLine(item);
}
}
}
|