MrME
MrME

Reputation: 337

Fill List<> from XML respond

My question is how can i reach

<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>

While filling a list

eventInfo = (from item in events.Descendants("item")
                         select new Event
                         {
                             EventId = Convert.ToInt16(item.Element("eventid").Value),
                             EventName = item.Element("eventname").Value,
                             EventCity = ??????????
                         }).ToList();

I've found Using LINQ to fill a List<object> from xml but there they don't dig deeper into the XML like i want to do

Thanks in advance

Upvotes: 0

Views: 575

Answers (1)

SLaks
SLaks

Reputation: 887827

item.Element("locationid").Element("city").Value

Upvotes: 3

Related Questions