Elemen SimpleType Skema XML
Referensi Skema XML Lengkap
Definisi dan Penggunaan
Elemen simpleType mendefinisikan tipe sederhana dan menetapkan batasan dan informasi tentang nilai atribut atau elemen teks saja.
Informasi Elemen
- Elemen induk: atribut, elemen, daftar, batasan, skema, persatuan
Sintaksis
<simpleType
id=ID
name=NCName
any attributes
>
(annotation?,(restriction|list|union))
</simpleType>
(Tanda ? menyatakan bahwa elemen dapat muncul nol atau satu kali di dalam elemen simpleType)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
name | Specifies a name for the element. This attribute is required if the simpleType element is a child of the schema element, otherwise it is not allowed |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
Contoh 1
Contoh ini mendefinisikan elemen yang disebut "usia" yang merupakan tipe sederhana dengan batasan. Nilai usia TIDAK boleh lebih rendah dari 0 atau lebih besar dari 100:
<xs:element name="age">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="100"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
Referensi Skema XML Lengkap