A new <complexType> can be defined by extending an existing <complexType> and adding additional items <all>, <choice>, <sequence>, <element>, <group>, <attribute>, <attributeGroup>.
ComplexTypes can only be defined at global level (as a child of the <schema>).
|The complex type that extends another complexType is given the icon .|
A <complexType> can only be added to the <schema> object. This can be done using the right click context menu Add Child->Complex Type.
The ComplexType is automatically turned into an extension when its type is set to another complexTye (in our example AddressType).
Name - The name the complex type will be referred to as. This must be unique, and its a good standard to postfix it with 'Type').
Type - (optional) It is possible to create a new complex type based on an existing simple or complex type. If you specify an existing type then there are 2 ways that the 'base' type can be interpreted determined by the 'Derived By' property.
Derived By - Only available when the base type is specified. If this is Extension , then the complexType takes all the properties of the 'Type' (elements/attributes etc), and allows a new compositor (<all>, <choice>, <sequence>) and <attribute>'s to be added to it. If the value is Restriction, then the complexType can ONLY contain the elements and attributes defined in the 'Type'. You can not add in elements and attributes that are not defined in the base type.
Abstract - If this is true then it means that the complexType can not be used on its own, it must be extended or restricted before it can be used (See 'Derived By' and 'Type' properties).
Block - Indicates that the type can not be substituted, extended or restricted - see 'Derived By' Property and Substitution Groups on <element>.
Final - .
Id - A user defined ID to uniquely identify the entity within the schema.
Mixed - Indicates if the XML element described by this complexType may contain text interspersed between its child elements (like HTML). It is recommended that is is false, as it makes processing the resulting XML documents more difficult, but it is sometimes necessary to use this.
The following XSD code
|ComplexType Example||Copy Code|
<xs:complexType name="AddressType"> <xs:sequence> <xs:element name="House" type="xs:string" /> <xs:element name="Town" type="xs:string" /> <xs:element name="Country" type="CountryCodeType" /> </xs:sequence> </xs:complexType> <xs:complexType name="USAddressType"> <xs:complexContent mixed="false"> <xs:extension base="AddressType"> <xs:sequence> <xs:element name="ZipCode" type="xs:string" /> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="UKAddressType"> <xs:complexContent mixed="false"> <xs:extension base="AddressType"> <xs:sequence> <xs:element name="PostCode" type="xs:string" /> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <xs:simpleType name="CountryCodeType"> <xs:restriction base="xs:string"> <xs:enumeration value="FR" /> <xs:enumeration value="DE" /> <xs:enumeration value="ES" /> <xs:enumeration value="UK" /> <xs:enumeration value="US" /> </xs:restriction> </xs:simpleType>
Properties that apply to a type are shown inline at the bottom of the items container.
Values that are inherited from the base types are shown in brackets, values specifically set against the item are shown without brackets.
If a facet is not valid for a given type (typically because of its data type), then its value is shown in red.
|Inline properties can be disabled in the Options.|