title: how to deserialize an xml node with a value and an attribute using asp.net serialization
body: <p>I have 4 small classes to deserialize xml from an incomming xml poll, to usable classes to build up the poll.</p>
  
  <p>now, i know how to set a property from a class, to match a certain attribute or element in the xml, and if that element is just a string thats easy
  but what if the element also has an attribute like in the following example?</p>
  
  <pre><code>&lt;Questions&gt;
   &lt;Question id="a guid"&gt;
    &lt;AnswerItems&gt;
     &lt;AnswerItem Id="a guid"&gt;3&lt;/AnswerItem&gt;
     &lt;AnswerItem Id="a guid"&gt;2&lt;/AnswerItem&gt;
     &lt;AnswerItem Id="a guid"&gt;5&lt;/AnswerItem&gt;
    &lt;/AnswerItems&gt;
   &lt;/Question&gt;
  &lt;/Questions&gt;
  </code></pre>
  
  <p>the question class would look like this:</p>
  
  <pre><code>[Serializable()]
  public class Question
  {
      [XmlAttribute("Id")]
      public Guid QuestionId { get; set; }
  
      [XmlArray("AnswerItems")]
      [XmlArrayItem("AnswerItem", typeof(AnswerItem))]
      public AnswerItem[] AnswerItems { get; set; }
  }
  
  [Serializable()]
  public class AnswerItem
  {
      [XmlAttribute("Id")]
      public Guid QuestionId { get; set; }
  
      // how do i fetch the value of this node? 
      // its not a XmlElement and it's not an XmlValue
  }
  </code></pre>
  
  <p>Ok, so the value of an AnswerItem node, that is what i want to get as well.
  i could easily not use the AnswerItem class, and just use an XmlArray AnswerItems of the type String and put the values in the array, but then i would lose the AnswerItem's Id Attribute.</p>