-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Order of elements in choice #380
Comments
Use substitution groups: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:element name="Operation">
<xs:complexType>
<xs:sequence>
<xs:element
ref="OperationElement"
minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="OperationElement" type="OperationType" abstract="true"/>
<xs:element name="Plus" type="PlusType" substitutionGroup="OperationElement"/>
<xs:element name="Minus" type="MinusType" substitutionGroup="OperationElement"/>
<xs:complexType name="OperationType" />
<xs:complexType name="PlusType">
<xs:complexContent>
<xs:extension base="OperationType" />
</xs:complexContent>
</xs:complexType>
<xs:complexType name="MinusType">
<xs:complexContent>
<xs:extension base="OperationType" />
</xs:complexContent>
</xs:complexType>
</xs:schema> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I have a problem similar to #285 and looking for solution/workaround.
I have an xml which contains sequence of Plus/Minus elements (simplified here) and their order matters to the backend.
And following xsd which utilizes choice.
With code generated by
XmlSchemaClassGenerator
I can't figure out how to preserve order of Plus/Minus operations, because it always dumps all thePlus
elements first andMinus
after.It worked fine with xsd.exe generated code, but with
XmlSchemaClassGenerator
handling choice differently - I can't figure out how to work around the problem without changing xsd to usexs:any
which is much worse than what xsd.exe generates.The text was updated successfully, but these errors were encountered: