XML Skema kompleksInhoud Element
❮ Voltooi XML-skemaverwysing
Definisie en gebruik
Die complexContent-element definieer uitbreidings of beperkings op 'n komplekse tipe wat slegs gemengde inhoud of elemente bevat.
Elementinligting
- Ouerelemente : kompleksTipe
Sintaksis
<complexContent
id=ID
mixed=true|false
any attributes
>
(annotation?,(restriction|extension))
</complexContent>
(Die ?-teken verklaar dat die element nul of een keer binne die komplekseInhoud-element kan voorkom)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
mixed | Optional. Specifies whether character data is allowed to appear between the child elements of this complexType element. Default is false |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
Voorbeeld 1
Die volgende voorbeeld het 'n komplekse tipe, "fullpersoninfo", wat afkomstig is van 'n ander komplekse tipe, "personinfo", deur die oorgeërfde tipe uit te brei met drie bykomende elemente (adres, stad en land):
<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:sequence>
</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:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
In die voorbeeld hierbo moet die "werknemer"-element in volgorde die volgende elemente bevat: "voornaam", "van", "adres", "stad" en "land".
❮ Voltooi XML-skemaverwysing