Hi,
I'm trying to generate a schema that will ultimately be transformed into a class that has a property that returns an array of elements.
The schema below (hand coded) correctly does this when pushed through xsd.exe (Microsoft Visual Studio 2005).
<?xml version="1.0"?>
<xs:schema targetNamespace="
http://www.testStuff.com/Handler" xmlns:xs="
http://www.w3.org/2001/XMLSchema" xmlns:hnd="
http://www.testStuff.com/InHand" xmlns:ce="
http://www.testStuff.com/CanonicalEvents">
<xs:import namespace="
http://www.testStuff.com/CanonicalEvents"/>
<xs:element name="InHand" type="hnd:InHand"/>
<xs:complexType name="InHand">
<xs:sequence>
<xs:element name="inHandDateTime" type="xs:dateTime"/>
<xs:element name="inHandId" type="xs:unsignedLong"/>
<xs:element name="inHandEvents" minOccurs="0" maxOccurs="1" type="hnd:ArrayofEvents"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ArrayofEvents">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="OpenEvent" type="ce:OpenEvent"/>
<xs:element name="CloseEvent" type="ce:CloseEvent"/>
<xs:element name="WarningEvent" type="ce:WarningEvent"/>
<xs:element name="VoidEvent" type="ce:VoidEvent"/>
<xs:element name="TimeoutEvent" type="ce:TimeoutEvent"/>
<xs:element name="BalanceEvent" type="ce:BalanceEvent"/>
<xs:element name="ReturnEvent" type="ce:ReturnEvent"/>
</xs:choice>
</xs:complexType>
</xs:schema>
The problem that I have is that I can't model this in EA. Even if I import this and roundtrip out, it still doesn't generate this schema. The specific problem appears to be with the unbounded choice. No matter what I use in EA I can't get it to properly generate the array in the form listed above.
I get this instead:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema targetNamespace="
http://www.testStuff.com/Handler" xmlns:xs="
http://www.w3.org/2001/XMLSchema" xmlns:hnd="
http://www.testStuff.com/InHand" xmlns:ce="
http://www.testStuff.com/CanonicalEvents">
<xs:import namespace="
http://www.testStuff.com/CanonicalEvents"/>
<xs:element name="InHand" type="hnd:InHand"/>
<xs:complexType name="InHand">
<xs:sequence>
<xs:element name="handDateTime" type="xs:dateTime"/>
<xs:element name="handId" type="xs:unsignedLong"/>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="OpenEvent" type="ce:OpenEvent"/>
<xs:element name="CloseEvent" type="ce:CloseEvent"/>
<xs:element name="WarningEvent" type="ce:WarningEvent"/>
<xs:element name="VoidEvent" type="ce:VoidEvent"/>
<xs:element name="ValueEvent" type="ce:ValueEvent"/>
<xs:element name="TimeoutEvent" type="ce:TimeoutEvent"/>
<xs:element name="BalanceEvent" type="ce:BalanceEvent"/>
<xs:element name="ReturnEvent" type="ce:ReturnEvent"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:schema>
Which is close, but no cigar. I've tried introducing an intermediary element, a complex type and just about everthing in between but to no avail.
Anyone seen / fixed / worked around this?
Thanks,
D.