<item>
<title>Lorem Ipsum</title>
<media:group>
<media:content url = "http://www.sample.com" rate = "0" />
<media:content url = "http://www.sample1.com" rate = "1" />
<media:content url = "http://www.sample2.com" rate = "2" />
</media:group>
</item>
我如何获得这个值:
我尝试使用此代码:
var query = from i in loadedData.Descendants("item")
select new Site
{
Title = (string)i.Element("title"),
Url = (string)i.Element(serv + "group").Elements(media + "content").Last()
};
site = query.ToList();
但 Url 的值为“”。我也有这个:
private static readonly XNamespace media = "http://www.sampleX.com/";