Where should I resctric the ocurrences of a type in an XML Schema, element or sequence
Is there any difference between limiting the occurrences of an element in the element tag or the sequence tag, what would be the best place to do it? Or it's just a matter of style?
Example:
<xs:element name="Provider">
<xs:complexType>
<xs:sequence minOcurrs="1" maxOccurs="unbounded">
<xs:element ref="Distribuitor"/>
</xs:sequence>
</xs:complexType>
</xs:element>
or
<xs:element name="Provider">
<xs:complexType>
<xs:sequence>
<xs:element ref="Distribuitor" minOcurrs="1" maxOccurs="unbounded"/&g开发者_如何学Ct;
</xs:sequence>
</xs:complexType>
</xs:element>
I would say to put it on the element instead because the sequence specifies the order in which the elements must appear. I believe if you put it on the elements themselves, you are being more clear on what you want. I don't think in your case it makes a difference with 1 element, but imagine if you had 10 elements for example and each element could have a different number of minOcurrs and maxOccurs, you probably would want to specify it on each element then instead of at the sequence level.
加载中,请稍侯......
精彩评论