title: Using XmlSerializer to deserialize complex type elements with choice
body: <p>I receive a XML that I'm having problem to deserialize, I cant make a class that fits the XML's schema.</p>
  
  <p>XML Schema (every type name beginning with "ts" is SimpleType):</p>
  
  <pre><code>&lt;xsd:element name="ConsultarSituacaoLoteRpsResposta"&gt;
      &lt;xsd:complexType&gt;
          &lt;xsd:choice&gt;
              &lt;xsd:sequence&gt;
                  &lt;xsd:element name="NumeroLote" type="tsNumeroLote" minOccurs="1" maxOccurs="1"/&gt;
                  &lt;xsd:element name="Situacao" type="tsSituacaoLoteRps" minOccurs="1" maxOccurs="1"/&gt;
              &lt;/xsd:sequence&gt;
              &lt;xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1"/&gt;
          &lt;/xsd:choice&gt;
      &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;
  
  &lt;xsd:element name="ListaMensagemRetorno"&gt;
      &lt;xsd:complexType&gt;
          &lt;xsd:sequence&gt;
              &lt;xsd:element name="MensagemRetorno" type="tcMensagemRetorno" minOccurs="1" maxOccurs="unbounded"/&gt;
          &lt;/xsd:sequence&gt;
      &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;
  
  &lt;xsd:complexType name="tcMensagemRetorno"&gt;
      &lt;xsd:sequence&gt;
          &lt;xsd:element name="Codigo" type="tsCodigoMensagemAlerta" minOccurs="1" maxOccurs="1"/&gt;
          &lt;xsd:element name="Mensagem" type="tsDescricaoMensagemAlerta" minOccurs="1" maxOccurs="1"/&gt;
          &lt;xsd:element name="Correcao" type="tsDescricaoMensagemAlerta" minOccurs="0"/&gt;
      &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;
  </code></pre>
  
  <p>I receive:</p>
  
  <p>XML 1</p>
  
  <pre><code>&lt;ConsultarSituacaoLoteRpsResposta xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.abrasf.org.br/ABRASF/arquivos/nfse.xsd"&gt;
      &lt;NumeroLote&gt;21&lt;/NumeroLote&gt;
      &lt;Situacao&gt;4&lt;/Situacao&gt;
  &lt;/ConsultarSituacaoLoteRpsResposta&gt;
  </code></pre>
  
  <p>Or XML 2</p>
  
  <pre><code>&lt;ConsultarSituacaoLoteRpsResposta xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.abrasf.org.br/ABRASF/arquivos/nfse.xsd"&gt;
     &lt;ListaMensagemRetorno&gt;
        &lt;MensagemRetorno&gt;
             &lt;Codigo&gt;E01&lt;/Codigo&gt;
             &lt;Mensagem&gt;AAA&lt;/Mensagem&gt;
             &lt;Correcao&gt;BBB&lt;/Correcao&gt;
        &lt;/MensagemRetorno&gt;
        &lt;MensagemRetorno&gt;
             &lt;Codigo&gt;E02&lt;/Codigo&gt;
             &lt;Mensagem&gt;CCC&lt;/Mensagem&gt;
             &lt;Correcao&gt;DDD&lt;/Correcao&gt;
        &lt;/MensagemRetorno&gt;
     &lt;/ListaMensagemRetorno&gt;
  &lt;/ConsultarSituacaoLoteRpsResposta&gt;
  </code></pre>
  
  <p>The choice between a sequence of 2 elements and an element is the problem. I can make a choice of elements ok, but the choise of 2 elements and one element no.</p>
  
  <p>How can I make a class to deserialize this schema? </p>