XSD: What's the difference between these two?
In the first one, I put the minOccurs and maxOccurs in the sequence
element:
<xs:element name="Prerequisites" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="Prerequisite" type="PrerequisiteType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
In the second one开发者_如何转开发, I put it in the contained element
element:
<xs:element name="Prerequisites" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="Prerequisite" type="PrerequisiteType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
In this particular case there is no difference, i.e. both definitions describe the same language.
What you define in first example is the limit of the occurrences of the whole sequence, in the second case only of one element of the sequence.
精彩评论