I have searched forever tryng to figure out what I am doing wrong in trying to deseralize some xml to a list. I am able to get the deserailzation of eveything but the answers, so the deserailization is working but it appears I am missing something on the class decorations. The answers show in the "testObj", but are null.
Any help is appreciated.
Sample Xml
<?xml version="1.0" encoding="utf-8" ?>
<TestObj xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<question>
    <stem>this is the question stem</stem>
    <answers>
      <answer>answer 1</answer>
      <answer>answer 2</answer>
      <answer>answer 3</answer>
      <answer>answer 4</answer>
 </question>
 <question .... </question>
 <question .... </question>
 <question .... </question>
</TestObj>
[Serializable]
    public class TestObj
    {
        [XmlElement(ElementName = "question")]
        [XmlElement(typeof(QuestionObj))]
        public List<QuestionObj> Questions { get; set; }
        public int Id { get; set; }
        public string Name;
    }
[Serializable]
    public class QuestionObj
    {
        [XmlElement(ElementName = "stem")]
        public string Stem { get; set; }
        [XmlArray("answers")]
        [XmlArrayItem(ElementName = "answer")]
        [XmlArrayItem(typeof(AnswerObj))]
        public List<AnswerObj> Answers { get; set; }
        public int TestId { get; set; }
        public int Id { get; set; }
    }
[Serializable]
   public class AnswerObj
    {
        [XmlElement(ElementName = "answer")]
        public string Answer { get; set; }
       public int Id { get; set; }
       public int StemId { get; set; }
    }
Object returned:
Question:this is the question stem
   answers
      answer:null
      answer null;
etc
 
     
     
     
     
    