calebkgibson
New Member
Let's assume working with xml documents like this:\[code\]<Item> <Price>10</Price> <Ratio>1.5</Ratio> <MaxPrice>18<MaxPrice></Item>\[/code\]and\[code\]<Item> <Price>12</Price></Item>\[/code\]The meaning of the data is: An Item must have a price and optionally ratio for iterative price change and a maximum price that should not be exceeded. To clarify: either only {\[code\]Price\[/code\]} or all three elements {\[code\]Price\[/code\], \[code\]Ratio\[/code\], \[code\]MaxPrice\[/code\]}. No other option is allowed.On a regular basis, XSD allows making elements optional using \[code\]minOccurs="0"\[/code\], so we can define an \[code\]Item\[/code\] like this:\[code\]<xs:element name="Item"> <xs:complexType> <xs:sequence> <xs:element name="Price" type="xs:integer" /> <xs:element name="Ratio" type="xs:float" minOccurs="0" /> <xs:element name="MaxPrice" type="xs:integer" minOccurs="0" /> </xs:sequence> </xs:complexType></xs:element>\[/code\]But that is not enough. This will let e.g. an \[code\]Item\[/code\] with only {\[code\]Price\[/code\] and \[code\]Ratio\[/code\]} through - which is not correct.How can this be done?