I want to create an XML schema containing the following:
<xs:complexType name="Record">
<xs:element name="RecordTag" type="xs:string" minOccurs="1" maxOccurs="1" />
<xs:element name="RecordSize" type="xs:string" minOccurs="1" maxOccurs="1" />
<xs:element name="RecordSection" type="xs:string" minOccurs="1" maxOccurs="1" />
<xs:element name="RecordName" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="RecordType" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="RecordValue" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="RecordDefault" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="RecordComment" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="RecordURL" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="Condition" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="Master" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="RecordCurrent" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="RecordId" type="xs:string" minOccurs="0" maxOccurs="1" />
</xs:complexType>
As you can tell from the comments, I want the top three elements to be required, and the rest are optional. The outline should allow the elements to appear in any order.
Now, if I use the indicator <xs:sequence>, the order is executed, which I do not want. If I use the indicator <xs:all>, then the diagram requires that all elements are displayed, even if the value is minOccursset to 0.
Is there any other indicator that I can use to accomplish my task?
Thank!
source
share