XML Schema anyAttribute Element
Referensi Skema XML Lengkap
Definisi dan Penggunaan
Elemen anyAttribute memungkinkan penulis untuk memperluas dokumen XML dengan atribut yang tidak ditentukan oleh skema.
Informasi Elemen
- Elemen induk: complexType, pembatasan (baik simpleContent dan complexContent), ekstensi (baik simpleContent dan complexContent), atributGroup
Sintaksis
<anyAttribute
id=ID
namespace=namespace
processContents=lax|skip|strict
any attributes
>
(annotation?)
</anyAttribute>
(Tanda ? menyatakan bahwa elemen dapat muncul nol atau satu kali di dalam elemen anyAttribute)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
namespace | Optional. Specifies the namespaces containing the
attributes
that can be used. Can be set to one of the following:
|
processContents | Optional. Specifies how the XML processor should handle
validation against the elements specified by this any element. Can be set to
one of the following:
|
any attributes | Optional. Specifies any other attributes with non-schema namespace |
Contoh 1
Contoh berikut menunjukkan deklarasi untuk elemen yang disebut "orang". Dengan menggunakan elemen <anyAttribute> penulis dapat menambahkan sejumlah atribut ke elemen "orang":
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:sequence>
<xs:anyAttribute/>
</xs:complexType>
</xs:element>
Referensi Skema XML Lengkap