I receive a XML that I'm having problem to deserialize, I cant make a class that fits the XML's schema.
XML Schema (every type name beginning with "ts" is SimpleType):
<xsd:element name="ConsultarSituacaoLoteRpsResposta">
<xsd:complexType>
<xsd:choice>
<xsd:sequence>
<xsd:element name="NumeroLote" type="tsNumeroLote" minOccurs="1" maxOccurs="1"/>
<xsd:element name="Situacao" type="tsSituacaoLoteRps" minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
<xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="ListaMensagemRetorno">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="MensagemRetorno" type="tcMensagemRetorno" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="tcMensagemRetorno">
<xsd:sequence>
<xsd:element name="Codigo" type="tsCodigoMensagemAlerta" minOccurs="1" maxOccurs="1"/>
<xsd:element name="Mensagem" type="tsDescricaoMensagemAlerta" minOccurs="1" maxOccurs="1"/>
<xsd:element name="Correcao" type="tsDescricaoMensagemAlerta" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
I receive:
XML 1
<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">
<NumeroLote>21</NumeroLote>
<Situacao>4</Situacao>
</ConsultarSituacaoLoteRpsResposta>
Or XML 2
<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">
<ListaMensagemRetorno>
<MensagemRetorno>
<Codigo>E01</Codigo>
<Mensagem>AAA</Mensagem>
<Correcao>BBB</Correcao>
</MensagemRetorno>
<MensagemRetorno>
<Codigo>E02</Codigo>
<Mensagem>CCC</Mensagem>
<Correcao>DDD</Correcao>
</MensagemRetorno>
</ListaMensagemRetorno>
</ConsultarSituacaoLoteRpsResposta>
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.
How can I make a class to deserialize this schema?