私はこの構造を持つxmlを持っています:
<news>
<id><![CDATA[1]]></id>
<title><![CDATA[My title]]></title>
<date><![CDATA[17-06-2013]]></date>
<machine><![CDATA[a]]></machine>
<machine><![CDATA[b]]></machine>
<machine><![CDATA[c]]></machine>
<machine><![CDATA[d]]></machine>
</news>
<news>
<id><![CDATA[2]]></id>
<title><![CDATA[My title 2]]></title>
<date><![CDATA[17-06-2013]]></date>
<machine><![CDATA[a]]></machine>
<machine><![CDATA[b]]></machine>
<machine><![CDATA[c]]></machine>
<machine><![CDATA[d]]></machine>
</news>
そして、私はそれを次のように読みました:
var datas = from query in loadedData.Descendants("news")
select new News
{
Title = (string)query.Element("title"),
Id = (string)query.Element("id"),
StrDate = (string)query.Element("date"),
list = query.Elements("machine")
};
コード
list = query.Elements("machine")
動作しません。タグ「マシン」を持つ要素のリストを取得する方法