XML Schema complexInhoud Element
❮ Volledige XML-schemareferentie
Definitie en gebruik
Het element complexContent definieert extensies of beperkingen voor een complex type dat alleen gemengde inhoud of elementen bevat.
Elementinformatie
- Bovenliggende elementen: complexType
Syntaxis
<complexContent
id=ID
mixed=true|false
any attributes
>
(annotation?,(restriction|extension))
</complexContent>
(Het ?-teken geeft aan dat het element nul of één keer kan voorkomen in het element complexContent)
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
Het volgende voorbeeld heeft een complex type, "fullpersoninfo", dat is afgeleid van een ander complex type, "personinfo", door het geërfde type uit te breiden met drie extra elementen (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 het bovenstaande voorbeeld moet het element "employee" achtereenvolgens de volgende elementen bevatten: "voornaam", "achternaam", "adres", "plaats" en "land".
❮ Volledige XML-schemareferentie