XML Schema anyAttribute ປະກອບຫົວຂໍ້
ການກໍານົດແລະການນໍາໃຊ້
anyAttribute ປະກອບຫົວຂໍ້ທີ່ຜູ້ສ້າງສາມາດຂະຫຍາຍ XML ສະບັບຜ່ານປະສົມປະສານທີ່ບໍ່ມີຂໍ້ຈໍາກັດ.
ຂໍ້ມູນຫົວຂໍ້
ບັນດາວັດຖຸ | ອະທິບາຍ |
---|---|
ຄັດຄ້ານການປະກົດ | ບໍ່ມີຂໍ້ຈໍາກັດ |
ປະທານຫົວຂໍ້ | complexType、restriction (simpleContent)、extension (simpleContent)、restriction (complexContent)、extension (complexContent)、attributeGroup |
Content | annotation |
Syntax
<anyAttribute id=ID namespace=namespace processContents=lax|skip|strict any attributes > (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 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 this element can appear.
- ##local - Elements not qualified by a namespace can appear.
- ##targetNamespace - Elements from the target namespace of the parent element containing this element 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 ທີ່ຄວາມປະສົງ any ທີ່ຈະຖືກນຳໃຊ້. ຖ້າບໍ່ມີການກໍານົດຂອງຄຳປະສົງ processContents, ຄຳປະສົງຄືກັບ strict. ຖ້າມີການກໍານົດ processContents, ຄຳປະສົງຕ້ອງເປັນໜຶ່ງຈາກບັນດາຄຳປະສົງທີ່ຖືກກໍານົດຢູ່ລັງ.
- strict - XML processor ຕ້ອງໄດ້ເຂົ້າເຖິງເອກະສານຮູບແບບທີ່ຕ້ອງການຂອງນາມນາຍບັນນານອກ, ແລະຕ້ອງທຳການການການກວດກາຂອງປະກອບທັງໝົດທີ່ມາຈາກນາມນາຍບັນນານອກທັງໝົດ (ຄຳປະສົງ).
- lax - ຄືກັບ strict; ແຕ່ວ່າບໍ່ສາມາດເຂົ້າເຖິງເອກະສານຮູບແບບ, ບໍ່ມີຄວາມຜິດພາດໃດໆຈະເກີດຂຶ້ນ.
- skip - XML processor ບໍ່ທຳການການການກວດກາຂອງປະກອບທັງໝົດທີ່ມາຈາກນາມນາຍບັນນານອກສະບັບທີ່ກໍານົດ.
any attributes
ທົດສະນະ. ກໍານົດປະສົມປະກອບທີ່ມີນາມນາຍບັນນານອກສະບັບຮູບແບບ.
ຄວາມທີ່ສະແດງ
ຄວາມທີ່ສະແດງພາຍໃນບົດສະຫຼຸບນີ້ແມ່ນການສະແດງຂອງປະກອບ "person". ຜ່ານການນຳໃຊ້ປະກອບ <anyAttribute>, ຜູ້ສ້າງສາມາດເພີ່ມປະສົມປະກອບທີ່ບໍ່ໄດ້ຖືກກໍານົດຕາມຮູບແບບ:
<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>