weirriver
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by weirriver
-
-
Indicators
in Schema
I am using XSD to define a message structure for a service oriented architecture such that:- a message represents a command queue that can contain any number of commands in any order.- the commands are valid for the service that will process them.- each command has unique arguments and responses (i.e. there is no simple definition of a command type).Below is an excerpt from the schema with most of the grizzly details removed:
<xs:element name="Commands"> <xs:complexType> <xs:choice> <xs:element name="CreateAccount" minOccurs="0" maxOccurs="unbounded" /> <xs:element name="DeleteAccount" minOccurs="0" maxOccurs="unbounded" /> <xs:element name="UpdateAccount" minOccurs="0" maxOccurs="unbounded" /> </xs:choice> </xs:complexType></xs:element>
I would like to be able to validate a message with the following structure:
<Commands> <DeleteAccount>... details ...</DeleteAccount> <UpdateAccount>... details ...</UpdateAccount> <CreateAccount>... details ...</CreateAccount> <CreateAccount>... details ...</CreateAccount> <CreateAccount>... details ...</CreateAccount> <UpdateAccount>... details ...</UpdateAccount></Commands>
I can't see that any of the existing indicators (all, sequence, choice) allow me to do this. I can get the message to validate with sequence if I forcibly re-order the elements:
<Commands> <CreateAccount>... details ...</CreateAccount> <CreateAccount>... details ...</CreateAccount> <CreateAccount>... details ...</CreateAccount> <DeleteAccount>... details ...</DeleteAccount> <UpdateAccount>... details ...</UpdateAccount> <UpdateAccount>... details ...</UpdateAccount></Commands>
This would force a re-order of the command queue on both the sending and receiving side, which is an unacceptable overhead.I'm still fairly new at this; I hope I'm just missing something. Any help would be welcome.
Indicators
in Schema
Posted
I found a solution, which is to use <xs:choice maxOccurs="unbounded"/> inside of a <xs:sequence> element. I was not aware that they could be "stacked".