I found out that it is possible to restrict the minimum and the maximum number of elements in a XML Schema.
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="full_name" type="xs:string"/>
<xs:element name="child_name" type="xs:string"
maxOccurs="10" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
I want to restrinct the number of elements to an exact number. Is there a numberOfOccurs
, or something like that? I could make it by setting the minOccurs to a value that is equal to maxOccurs... for example..
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="full_name" type="xs:string"/>
<xs:element name="child_name" type="xs:string"
maxOccurs="10" minOccurs="10"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Is there a specific way for doing it?
没有单独的基数约束,例如exactlyOccurs
-仅使用将minOccurs
和maxOccurs
设置为与您期望的值相同的值即可。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.