The .NET framework 2.0 behavior is better: It flattens the choice, but it
still allows you to create and read valid instances:
public partial class test {
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("e1")]
[System.Xml.Serialization.XmlElementAttribute("e2")]
[System.Xml.Serialization.XmlElementAttribute("e3")]
[System.Xml.Serialization.XmlElementAttribute("e4")]
[System.Xml.Serialization.XmlElementAttribute("e5")]
[System.Xml.Serialization.XmlChoiceIdentifierAttrib ute("ItemsElementName")]
public string[] Items;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Item sElementName")]
[System.Xml.Serialization.XmlIgnoreAttribute()]
public ItemsChoiceType[] ItemsElementName; }
"Sergey Poberezovskiy" <Se*****************@discussions.microsoft.com> wrote
in message news:D7**********************************@microsof t.com...
Hi,
If I define my schema as
<xs:choice>
<xs:sequence>
<xs:element ref="el_1" />
<xs:element ref="el_2" />
</xs:sequence>
<xs:sequence>
<xs:element ref="el_3" />
<xs:element ref="el_4" />
<xs:element ref="el_5" />
</xs:sequence>
<xs:choice>
and compile it with .Net 2003 xsd.exe, then I receive only one
[ ... choice element attributes ..]
public string Item;
// with the choice type one of the following:
public enum ItemChoiceType
{ el_1, el_2, el_3, el_4, el_5 }
So instead of choosing between two sequences, XmlSerialiser chooses
between the first two elements in those sequences, and the rest is just ignored!!!
I NEED the rest as well.
Can anyone please point me in the right direction on how to read the rest
of the sequences?
Thanks in advance,
Sergey