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("customer").Attributes("Company")
select c;
foreach (var item in queryResults)
{
Console.WriteLine(item);
}
}
}
|