XML Schema attributeGroup Element
❮ การอ้างอิงสคีมา XML ที่สมบูรณ์
ความหมายและการใช้งาน
องค์ประกอบ attributeGroup ใช้เพื่อจัดกลุ่มชุดของการประกาศแอตทริบิวต์เพื่อให้สามารถรวมเป็นกลุ่มในคำจำกัดความประเภทที่ซับซ้อนได้
ข้อมูลองค์ประกอบ
- องค์ประกอบหลัก: attributeGroup, complexType, schema, ข้อจำกัด (ทั้ง simpleContent และ complexContent), ส่วนขยาย (ทั้ง simpleContent และ complexContent)
ไวยากรณ์
<attributeGroup
id=ID
name=NCName
ref=QName
any attributes
>
(annotation?),((attribute|attributeGroup)*,anyAttribute?))
</attributeGroup>
(เครื่องหมาย ? ประกาศว่าองค์ประกอบสามารถเกิดขึ้นได้เป็นศูนย์หรือครั้งเดียว และเครื่องหมาย * ประกาศว่าองค์ประกอบนั้นสามารถเกิดขึ้นได้เป็นศูนย์หรือมากกว่าภายในองค์ประกอบกลุ่มแอตทริบิวต์)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
name | Optional. Specifies the name of the attribute group. Name and ref attributes cannot both be present |
ref | Optional. Specifies a reference to a named attribute group. Name and ref attributes cannot both be present |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
ตัวอย่าง 1
<xs:attributeGroup name="personattr">
<xs:attribute name="attr1" type="string"/>
<xs:attribute name="attr2" type="integer"/>
</xs:attributeGroup>
<xs:complexType name="person">
<xs:attributeGroup ref="personattr"/>
</xs:complexType>
ตัวอย่างข้างต้นกำหนดกลุ่มแอ็ตทริบิวต์ชื่อ "personattr" ซึ่งใช้ในประเภทที่ซับซ้อนที่ชื่อว่า "person"
❮ การอ้างอิงสคีมา XML ที่สมบูรณ์