0

我的问题是我怎样才能到达

<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

提前致谢

4

1 回答 1

3
item.Element("locationid").Element("city").Value
于 2012-04-10T13:41:09.177 回答