日期:2014-05-17 浏览次数:20462 次
string xmlString = @"<xml><book id=""aaaa"" name = ""bbbb"" author = ""cccc""></book></xml>";
XDocument doc = XDocument.Parse(xmlString);
foreach (var attr in doc.Root.Element("book").Attributes())
{
Console.WriteLine(attr.Name + ": " + attr.Value);
}