http://www.dreamincode.net/forums/xml.php?showuser=335389
上記の XML を考えると、各子グループが値が異なるだけで同じであることを考えると、「lastvisitors」要素内の各要素をどのように反復処理できますか?
//Load latest visitors.
var visitorXML = xml.Element("ipb").Element("profile").Element("latestvisitors");
これで、必要なものすべてを含む XElement をキャプチャできました。要素をループして必要なものを取得する方法はありますか?
必要な情報を保持することのみを目的とする Visitor という POCO オブジェクトがあります。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SharpDIC.Entities
{
public class Visitor
{
public string ID { get; set; }
public string Name { get; set; }
public string Url { get; set; }
public string Photo { get; set; }
public string Visited { get; set; }
}
}
助けてくれてありがとう。