XML Schema 参考手册 完整 XML Schema 参考手册 The complexContent element defines extensions or restrictions on complex types that contain mixed content or only elements. 父元素: ComplexType (? The symbol declaration element can appear zero or once within the complexContent element. ) Attribute Description Id Optional. Specifies the unique ID of the element. Mixed Optional. Specifies whether character data is allowed to appear between children of the complexType element. The default is false. Any attributes Optional. Specifies any other attributes with the non-schema namespace. In the following example, there is a complex type “fullpersoninfo” that is derived from another complex type “personinfo” by extending the inherited type with three supplementary elements: In the above example, the “employee” element must contain the following elements in order: “firstname”, “lastname”, “address”, “city”, and “country”.Definition and usage ¶
Element information ¶
Grammar ¶
<complexContent
id=ID
mixed=true|false *
any attributes*
>
(annotation?,(restriction|extension))
</complexContent>
Example 1 ¶
<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>