XML Schema complexContent ປະກອບ

define and use

define and use of complexContent element that defines the extension or restriction of complex type (including mixed content or only elements).

element information

occurrence once
parent element complexType
content

annotation

ຄວາມຄິດທີ່ຈະປົກປ້ອງຂອງປະກອບທີ່ມີຫຼາຍຫຼືບໍ່ມີຫຼາຍຂອງເຫຼົ່ານັ້ນ: restriction (complexContent) ຫຼື extension (complexContent).

ການນຳໃຊ້ພາສານິວັບ.

<complexContent
id=ID
mixed=true|false
any attributes
>
(annotation?,(restriction|extension))
</complexContent>

(? 符号声明元素可在 complexContent 元素内出现零次或一次。)

ປະກອບປະກອບ ການອະທິບາຍ
id ຄວາມຄິດທີ່ຈະປົກປ້ອງຂອງບັນດາບັນທຶກລະຫວ່າງຊັ້ນປະເພດພຽງພໍດຽວ.
mixed ຄວາມຄິດທີ່ຈະປົກປ້ອງຂອງຄວາມຂອງຄຳຂັດແຍ່ງໃນລາຍການລັກສະນະຊັ້ນປະເພດ complexType. ຄຳສັ່ງເດີມຈະແມ່ນ false.
any attributes ຄວາມຄິດທີ່ຈະປົກປ້ອງຂອງປະກອບປະກອບອື່ນໆທີ່ມີຊັ້ນປະເພດ non-schema.

ຄວາມຄິດທີ່ມີຫຼັກການ.

ບັນທັດພາຍໃນນີ້ມີຮູບແບບຊັ້ນປະເພດ "fullpersoninfo",ຮູບແບບນີ້ມີມາຈາກຮູບແບບ "personinfo" ຜ່ານການຂະຫຍາຍຮູບແບບທີ່ມີສາມປະກອບເພີ່ມຕື່ມຢູ່.

<xs:element name="employee" type="fullpersoninfo"/>
<xs:complexType name="personinfo">
  <xs:sequence>
    <xs:element name="firstname" type="xs:string"/>
    <xs:element name="lastname" type="xs:string"/>
  
</xs:complexType>
<xs:complexType name="fullpersoninfo">
  <xs:complexContent>
    <xs:extension base="personinfo">
      <xs:sequence>
        <xs:element name="address" type="xs:string"/>
        <xs:element name="city" type="xs:string"/>
        <xs:element name="country" type="xs:string"/>
      
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

ໃນຕົວຢ່າງນີ້, "employee" ສັບສິນຕ້ອງຈະບັນທຶກສັບສິນທີ່ຫຼັງນັ້ນ: "firstname", "lastname", "address", "city" ແລະ "country".