XML Schema Definition

Kherani

New Member
Im trying to create an xml schema that can capture the following behavior:[*]\[code\]<info>\[/code\] element should be the first inside \[code\]<root>\[/code\][*]\[code\]<ParamA>, <ParamB>, <ParamC>, <ParamD>\[/code\], and \[code\]<ParamE>\[/code\] are optional, should appear after the \[code\]<info>\[/code\] element and can appear in any order.The following xml are valid:\[code\]<root> <info></info> <ParamA></ParamA> <ParamB></ParamB> <ParamC></ParamC> <ParamD></ParamD> <ParamE></ParamE></root>\[/code\]OR\[code\]<root> <info></info> <ParamB></ParamB><!--Interchangeable with other Param--> <ParamD></ParamD><!--Interchangeable with other Param--> <ParamC></ParamC><!--Interchangeable with other Param--> <ParamA></ParamA><!--Interchangeable with other Param--> <ParamE></ParamE><!--Interchangeable with other Param--></root>\[/code\]The following xml is NOT valid:\[code\]<root> <ParamB></ParamB> <ParamD></ParamD> <ParamC></ParamC> <ParamA></ParamA> <info></info> <!--This should appear as the first element inside root--> <ParamE></ParamE></root>\[/code\]I have tried doing:\[code\]<xs:sequence> <xs:element name="info" minOccurrence="0"> <xs:all> <xs:element name="ParamA" minOccurrence="0"> <xs:element name="ParamB" minOccurrence="0"> <xs:element name="ParamC" minOccurrence="0"> <xs:element name="ParamD" minOccurrence="0"> <xs:element name="ParamE" minOccurrence="0"> </xs:all></xs:sequence>\[/code\]This causes an invalid xml schema error because an all model group is not allowed to appear inside another model group.I've also tried substitution:\[code\]<xs:complexType name="information"> <xs:all> <xs:element name="info" minOccurrence="0"> </xs:all></xs:complexType><xs:complexType> <xs:complexContent> <xs:extension base="information"> <xs:all> <xs:element name="ParamA" minOccurrence="0"> <xs:element name="ParamB" minOccurrence="0"> <xs:element name="ParamC" minOccurrence="0"> <xs:element name="ParamD" minOccurrence="0"> <xs:element name="ParamE" minOccurrence="0"> </xs:all> </xs:extension> </xs:complexContent> </xs:complexType>\[/code\]This is still getting an xml schema error on the usage of all model group.Does anyone have a similar problem or have any idea how to create an xml schema for the desired behavior stated above? Thanks.
 
Back
Top