【发布时间】:2012-04-10 13:38:48
【问题描述】:
我的问题是如何到达
<xml>
<item>
<eventid>1</eventid>
<eventname>Test</eventname>
<startdate>2012-04-30 12:00:00</startdate>
<locationid>
<locationid>1</locationid>
<city>Amsterdam</city> <-----------This field
<venuename>Java-eiland</venuename>
</locationid>
</item>
</xml>
在填写列表时
eventInfo = (from item in events.Descendants("item")
select new Event
{
EventId = Convert.ToInt16(item.Element("eventid").Value),
EventName = item.Element("eventname").Value,
EventCity = ??????????
}).ToList();
我找到了Using LINQ to fill a List<object> from xml 但他们并没有像我想要的那样深入研究 XML
提前致谢
【问题讨论】:
-
只需在 locationid 上调用 .element 即可下一级。
标签: c# xml linq windows-phone-7