XML Schema sequence element

ການອະທິບາຍ ແລະ ການນໍາໃຊ້

sequence ປະກອບຕ້ອງການວ່າປະກອບໃນກຸ່ມຈະສະແດງຢູ່ໃນຄວາມທີ່ກ່ຽວກັບປະກອບທີ່ກວມ. ບັນດາລູກປະກອບສາມາດສະແດງຢູ່ 0 ຄັ້ງ ຫາຫຼາຍຄັ້ງ.

ຂໍ້ມູນປະກອບ

ຄັ້ງວຽກ ໃນກຸ່ມຄົງເປັນຄັ້ງດຽວ; ບໍ່ແມ່ນຄວາມຫວງຫານຫາຍ.
ປະທານປະກອບ group、choice、sequence、complexType、restriction (simpleContent)、extension (simpleContent)、restriction (complexContent)、extension (complexContent)
content annotation、any、choice、element、group、sequence

syntax

<sequence
id=ID
maxOccurs=nonNegativeInteger|unbounded
minOccurs=nonNegativeInteger
any attributes
>
(annotation?,(element|group|choice|sequence|any)*)
</sequence>

(? ການປະກາດໃນ element sequence ທີ່ສະມາຊິກຈະສາມາດປະກອງໄວ້ຢ່າງຕ້ອງການທີ່ຕ້ອງຫຼັງຈາກການປະກາດຢ່າງສະຫຼາກຫຼັງຈາກສິນລະຫັດສອງ. )

attributes description
id id
maxOccurs maxOccurs
minOccurs minOccurs
any attributes ຄວາມອາດຈະບໍ່ມີ. ການຈຳນວນຜົນຢູ່ອາດສາມາດມີສິນລະຫັດບໍ່ມີຫຼັກສະນະຫຼັກ. ຄວາມຜົນຢູ່ທີ່ສອງທີ່ຫຼາຍກວ່າຫຼັງຈາກສິນລະຫັດສອງ. ການຈຳນວນຢູ່ທີ່ໄດ້ຕັ້ງເປັນສິນລະຫັດສະຫຼາກວ່າຫຼັງຈາກສິນລະຫັດສອງ, ການຈຳນວນຢູ່ທີ່ໄດ້ຕັ້ງເປັນ 0. ຄວາມຜົນຢູ່ທີ່ມີເປັນ 1.

ຕົວຢ່າງ

ຕົວຢ່າງ 1

ນີ້ເປັນຕົວຢ່າງຂອງການປະກາດ "personinfo" ປະກອບຕົວຢ່າງຕ້ອງການທີ່ໄດ້ປະກອງໄວ້ຢ່າງຕໍ່ເນື່ອງຕ່າງໆ 5 ບັນດາສະມາຊິກ: "firstname", "lastname", "address", "city", ແລະ "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>

Example 2

Example 2 is a declaration for the "pets" element, which can contain zero or more dog and cat elements:

<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>