title: MVC 4.0 - Xml to model
body: <p>I have a system that returns xml, and I need to build some MVC pages that use this data. I'm using MVC 4.0 and C# FW4.0.
  I'm populating my models like this:</p>
  
  <pre><code>List&lt;PersonName&gt; tmpList = new List&lt;PersonName&gt;();
  IEnumerable&lt;PersonName&gt; PeopleNames = tmpList;                
  XDocument oDoc = XDocument.Parse(sResponse);
  
  var vPeopleNames = from c in oDoc.Descendants("PersonName")
                     select new PersonName()
                     {
                         PersonID = (string)c.Element("PersonID"),                                 
                         FirstName = (string)c.Element("FirstName"),
                         LastName = (string)c.Element("LastName")
                     };
  
  PeopleNames = vPeopleNames;
  var oModel = PeopleNames;           
  
  return View("PeopleNamesList", PeopleNames);
  </code></pre>
  
  <p>I would like to know if there is a way to do this automatically. I don't want to specify the names of the fields "PersonID", "FirstName" and "LastName". If i'll have 50 fields it will be too painful...</p>