XML Schema all Element
❮ การอ้างอิงสคีมา XML ที่สมบูรณ์
ความหมายและการใช้งาน
องค์ประกอบทั้งหมดระบุว่าองค์ประกอบย่อยสามารถปรากฏในลำดับใดก็ได้ และองค์ประกอบย่อยแต่ละรายการสามารถเกิดขึ้นได้เป็นศูนย์หรือครั้งเดียว
ข้อมูลองค์ประกอบ
- องค์ประกอบหลัก:กลุ่ม, complexType, ข้อจำกัด (ทั้ง simpleContent และ complexContent), ส่วนขยาย (ทั้ง simpleContent และ complexContent)
ไวยากรณ์
<all
id=ID
maxOccurs=1
minOccurs=0|1
any attributes
>
(annotation?,element*)
</all>
(เครื่องหมาย ? ประกาศว่าองค์ประกอบสามารถเกิดขึ้นได้เป็นศูนย์หรือครั้งเดียว และเครื่องหมาย * ประกาศว่าองค์ประกอบนั้นสามารถเกิดขึ้นได้เป็นศูนย์หรือมากกว่าภายในองค์ประกอบทั้งหมด)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
maxOccurs | Optional. Specifies the maximum number of times the element can occur. The value must be 1. |
minOccurs | Optional. Specifies the minimum number of times the element can occur. The value can be 0 or 1. Default value is 1 |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
ตัวอย่าง 1
<xs:element name="person">
<xs:complexType>
<xs:all>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:all>
</xs:complexType>
</xs:element>
ตัวอย่างข้างต้นระบุว่าองค์ประกอบ "ชื่อ" และ "นามสกุล" สามารถปรากฏในลำดับใดก็ได้ แต่องค์ประกอบทั้งสองจะต้องเกิดขึ้นเพียงครั้งเดียว!
ตัวอย่าง 2
<xs:element name="person">
<xs:complexType>
<xs:all>
<xs:element name="firstname" type="xs:string" minOccurs="0"/>
<xs:element name="lastname" type="xs:string" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
ตัวอย่างข้างต้นบ่งชี้ว่าองค์ประกอบ "ชื่อ" และ "นามสกุล" สามารถปรากฏในลำดับใดก็ได้ และแต่ละองค์ประกอบสามารถปรากฏเป็นศูนย์หรือครั้งเดียวได้!
❮ การอ้างอิงสคีมา XML ที่สมบูรณ์