XML Schema sequence element
Definition and usage
The sequence element requires that the elements within the group appear in the specified order within the containing elements. Each child element can appear 0 times to any number of times.
element information
occurrence times | once within the group; otherwise unrestricted. |
parent element | 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 นี้ที่อาจปรากฏ 0 หรือ 1 ครั้ง。)
คุณสมบัติ | คำอธิบาย |
---|---|
id | เลือกตั้ง。กำหนดรหัสเดียวกันของตัวเศษนี้ |
maxOccurs | เลือกตั้ง。กำหนดครั้งที่ any อาจปรากฏในตัวเศษเดียวกันของต้นฉบับสูงสุด ค่านี้จะเป็นตัวเลขเต็มที่มากกว่าหรือเท่ากับ 0 ถ้าไม่ต้องการกำหนดข้อจำกัดใดๆ ให้ค่า "unbounded" ค่าเริ่มต้นคือ 1。 |
minOccurs | เลือกตั้ง。กำหนดครั้งที่ any อาจปรากฏในตัวเศษเดียวกันของต้นฉบับคงที่สุด ค่านี้จะเป็นตัวเลขเต็มที่มากกว่าหรือเท่ากับ 0 ถ้าต้องการกำหนดว่ากลุ่ม any นี้เป็นความเลือกตั้ง โปรดตั้งค่าคุณสมบัตินี้เป็น 0 ค่าเริ่มต้นคือ 1。 |
any attributes | เลือกตั้ง。กำหนดคุณสมบัติอื่นที่มีชื่อเรียก non-schema ใดๆ。 |
ตัวอย่าง
ตัวอย่าง 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>
ตัวอย่าง 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>