anyAttribute ປະກອບ XML Schema
ການກໍານົດ ແລະ ການນໍາໃຊ້
anyAttribute ປະກອບສະເໜີຜູ້ສ້າງສາມາດຂະຫຍາຍເອກະສານ XML ຜ່ານບັນດາລັກສະນະທີ່ບໍ່ມີການຈັດການໂດຍ schema.
ຂໍ້ມູນສັບສົນຂອງບັນດາປະກອບ
ບັນດາອົງການ | ອະທິບາຍ |
---|---|
ຄັດຄ້ານການເກີດຂື້ນ | ບໍ່ມີຄວາມຈໍາກັດ |
ປະທານຕົວ | complexType、restriction (simpleContent)、extension (simpleContent)、restriction (complexContent)、extension (complexContent)、attributeGroup |
ຂັ້ນຕົວ | annotation |
ວິນຍານ
<anyAttribute id=ID namespace=namespace processContents=lax|skip|strict ປະກອບປະກອບທີ່ບໍ່ມີຊິວະນິຍົມ > (annotation?) </anyAttribute>
(? Symbol indicates that the element can appear zero or one time within the anyAttribute element.)
Attributes
id
Optional. Specify the unique ID of the element.
namespace
Optional. Specify the namespace of the elements that can be used. If no namespace is specified, ##any is the default value. If a namespace is specified, it must be one of the following values.
- ##any - Elements from any namespace can appear (default).
- ##other - Elements from any namespace other than the target namespace of the parent element of the element can appear.
- ##local - Elements not qualified by a namespace can appear.
- ##targetNamespace - Elements from the target namespace of the parent element of the element containing this can appear.
- {URI references of namespaces, ##targetNamespace, ##local} list - Elements from the namespace list separated by spaces can appear. The list can contain the following: URI references of namespaces ##targetNamespace and ##local.
processContents
ທາງເລືອກ. ສິ່ງຊີ້ວິດວ່າຄວາມຈິງຂອງຄວາມພິຈາລະນາ XML document ທີ່ຈະຖືກກວດກາໂດຍຄວາມພິຈາລະນາທີ່ຕົກລົງໂດຍ any element. ຖ້າບໍ່ມີການຕົກລົງ processContents, ຄົບຄາວຈະເປັນ strict. ຖ້າຕົກລົງ processContents, ຕ້ອງເປັນຄຳເວລາທີ່ກ່ຽວກັບນັ້ນ.
- strict - XML processor ຕ້ອງໄດ້ຮັບຕົວແທນຂອງຊິວະນິຍົມທີ່ຕ້ອງການ, ແລະຕ້ອງກວດກາທັງໝົດຂອງປະກອບປະກອບທີ່ມີຊິວະນິຍົມຈາກນັ້ນ. (ຄົບຄາວ)
- lax - ຄືກັບ strict; ແຕ່ວ່າບໍ່ສາມາດເຂົ້າເຖິງຕົວແທນ, ບໍ່ມີຄວາມຜິດພາດ.
- skip - XML processor ບໍ່ຈະກວດກາທັງໝົດຂອງປະກອບປະກອບທີ່ມີຊິວະນິຍົມຕົວແທນ.
ປະກອບປະກອບທີ່ບໍ່ມີຊິວະນິຍົມ
ທາງເລືອກ. ພົບກັບປະກອບປະກອບທີ່ມີຊິວະນິຍົມ non-schema.
ຕົວຢ່າງ
ບົດສະຫຼຸບນີ້ສະແດງຄວາມກັບ "person" ສາຂາ. ຜ່ານການນຳໃຊ້ <anyAttribute> ສາຂາ, ຜູ້ສ້າງສາມາດເພີ່ມລະຫວ່າງປະກອບປະກອບຂອງ "person" ທີ່ບໍ່ມີຊິວະນິຍົມ:
<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>