XML Schema sequence ÔªËØ

¶¨ÒåºÍÓ÷¨

sequence ÔªËØÒªÇó×éÖеÄÔªËØÒÔÖ¸¶¨µÄ˳Ðò³öÏÖÔÚ°üº¬ÔªËØÖС£Ã¿¸ö×ÓÔªËØ¿É³öÏÖ 0 ´Îµ½ÈÎÒâ´ÎÊý¡£

ÔªËØÐÅÏ¢

³öÏÖ´ÎÊý ÔÚ×éÄÚΪһ´Î£»·ñÔòΪÎÞÏÞÖÆ¡£
¸¸ÔªËØ group¡¢choice¡¢sequence¡¢complexType¡¢restriction (simpleContent)¡¢extension (simpleContent)¡¢restriction (complexContent)¡¢extension (complexContent)
ÄÚÈÝ annotation¡¢any¡¢choice¡¢element¡¢group¡¢sequence

Óï·¨

<sequence
id=ID
maxOccurs=nonNegativeInteger|unbounded
minOccurs=nonNegativeInteger
any attributes
>

(annotation?,(element|group|choice|sequence|any)*)

</sequence>

£¨? ÉùÃ÷ÔÚ sequence ÔªËØÖиÃÔªËØ¿É³öÏÖÁã´Î»òÒ»´Î¡££©

ÊôÐÔ ÃèÊö
id ¿ÉÑ¡¡£¹æ¶¨¸ÃÔªËØµÄΨһµÄ ID¡£
maxOccurs ¿ÉÑ¡¡£¹æ¶¨ any ÔªËØÔÚ¸¸ÔªËØÖпɳöÏÖµÄ×î´ó´ÎÊý¡£¸ÃÖµ¿ÉÒÔÊÇ´óÓÚ»òµÈÓÚÁãµÄÕûÊý¡£Èô²»Ïë¶Ô×î´ó´ÎÊýÉèÖÃÈκÎÏÞÖÆ£¬ÇëʹÓÃ×Ö·û´® "unbounded"¡£ ĬÈÏֵΪ 1¡£
minOccurs ¿ÉÑ¡¡£¹æ¶¨ any ÔªËØÔÚ¸¸ÔªËØÖпɳöÏÖµÄ×îС´ÎÊý¡£¸ÃÖµ¿ÉÒÔÊÇ´óÓÚ»òµÈÓÚÁãµÄÕûÊý¡£ÈôÒªÖ¸¶¨¸Ã any ×éÊÇ¿ÉÑ¡µÄ£¬Ç뽫´ËÊôÐÔÉèÖÃΪÁã¡£ ĬÈÏֵΪ 1¡£
any attributes ¿ÉÑ¡¡£¹æ¶¨´øÓÐ non-schema ÃüÃû¿Õ¼äµÄÈÎºÎÆäËûÊôÐÔ¡£

ʵÀý

Àý×Ó 1

±¾ÀýÊÇÒ»¸öÕë¶Ô "personinfo" ÔªËØµÄÉùÃ÷£¬¸ÃÔªËØ±ØÐ谴˳Ðò°üº¬ÏÂÁÐ 5 ¸öÔªËØ£º"firstname", "lastname", "address", "city", and "country"¡£

<xs:element name="personinfo">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="firstname" type="xs:string"/>
      <xs:element name="lastname" type="xs:string"/>
      <xs:element name="address" type="xs:string"/>
      <xs:element name="city" type="xs:string"/>
      <xs:element name="country" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

Àý×Ó 2

±¾ÀýÊÇÒ»¸öÕë¶Ô "pets" ÔªËØµÄÉùÃ÷£¬¿É°üº¬Áã¸ö»ò¶à¸ö dog ºÍ cat ÔªËØ£º

<xs:element name="pets">
  <xs:complexType>
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:element name="dog" type="xs:string"/>
      <xs:element name="cat" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>
VUE