2
xmlのすべての情報を配列に格納する必要があります。私は常にXMLから最初の項目を取得するので、私のコードは機能しません。C#LINQ - XMLを読む
誰でもこれを解決する方法を知っていますか? - しかし、あなたはすべての<item>...</item>
の要素をループするつもりのように見える - 上記のものです
var items = from item in xdoc.Descendants("item")
select new
{
Title = item.Element("title").Value,
// *** NOTE: xml has "desc", not "description"
Description = item.Element("desc").Value
};
それは、サンプルXMLせずに必ずすることは困難少しです:についてどのように
XDocument xdoc = XDocument.Load("http://www.thefaxx.de/xml/nano.xml");
var items = from item in xdoc.Descendants("items")
select new
{
Title = item.Element("item").Element("title").Value,
Description = item.Element("item").Element("description").Value
};
foreach (var item in items)
{
listView1.Items.Add(item.Title);
}
XMLの外観はどうですか? –