[xsd-users] Sequence of choices in code generated by xsd
Vladimir Zykov
vladimir.zykov at doctormobile.us
Mon Mar 3 11:46:33 EST 2014
Hi Boris,
I encountered a problem with xsd when I have an unbounded sequence of choices. I use xsd built from latest sources in cxx-tree mode. It generates for each member of choice a sequence but I'd rather expect to have something like in code generated by xsde in cxx-hybrid mode. It generates a union for a choice and puts in a sequence. For example, for the following XML Schema:
<xs:element name="a">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:choice>
<xs:element name="b" type="xs:string"/>
<xs:element name="c" type="xs:string"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
I have in 'a' two separate sequences for 'b' and 'c'. For me it's important to preserve an order of 'b' and 'c' from the original XML document. Can it be done with xsd and if not will it ever support such a feature?
Note: code generation is very much the same even if sequence is removed. I.e.
<xs:element name="a">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="b" type="xs:string"/>
<xs:element name="c" type="xs:string"/>
</xs:choice>
</xs:complexType>
</xs:element>
Thanks
Vladimir Zykov
Software Engineer
Doctor Mobile, LLC
More information about the xsd-users
mailing list