Atribut Skema XML, Elemen Grup
Referensi Skema XML Lengkap
Definisi dan Penggunaan
Elemen attributeGroup digunakan untuk mengelompokkan sekumpulan deklarasi atribut sehingga dapat digabungkan sebagai grup ke dalam definisi tipe yang kompleks.
Informasi Elemen
- Elemen induk: attributeGroup, complexType, skema, pembatasan (baik simpleContent dan complexContent), ekstensi (baik simpleContent dan complexContent)
Sintaksis
<attributeGroup
id=ID
name=NCName
ref=QName
any attributes
>
(annotation?),((attribute|attributeGroup)*,anyAttribute?))
</attributeGroup>
(Tanda ? menyatakan bahwa elemen dapat muncul nol atau satu kali, dan tanda * menyatakan bahwa elemen dapat muncul nol kali atau lebih di dalam elemen 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 |
Contoh 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>
Contoh di atas mendefinisikan grup atribut bernama "personattr" yang digunakan dalam tipe kompleks bernama "person".
Referensi Skema XML Lengkap