Complex Type Derivation Using the Restriction Mechanism
Derivation by restriction is similar to derivation by extension, in terms of BizTalk Editor functionality. A complex type derived by restriction is similar to its base data type, except that its declarations are more limited than the corresponding declarations in the base data type. In fact, the values represented by the new type are a subset of the values represented by the base data type (as is the case with restriction of simple types). An application prepared for the values of the base data type ought to be able to successfully process any of the values of the restricted type.
For comprehensive information about deriving new complex types by using the restriction mechanism, refer to the W3C website. For various links to this and other websites, see XSD Resources on the Web.
To derive from a complex global type by restriction, in another location in the schema tree, begin by inserting a new Record node at the desired location. Then set its Base Data Type property to the name of a complex global type. Finally, change the setting of the Derived By property from its default value of Extension (at least when a base data type is set) to Restriction.
In the following example, BillingAddress is the name of the newly inserted Record node, and GlobalAddrType is the name of the complex global type from which it derives, and intends to restrict. In the schema tree view, a duplicate node structure would be displayed below the node named BillingAddress, identical to the adjacent node structure under the node named ShippingAddress. The difference between them is that the BillingAddress node structure will be subject to possible restrictions to the base data type GlobalAddrType, and the ShippingAddress structure will remain identical to the base data type GlobalAddrType.
Because you have chosen to restrict the base data type, you are not allowed to insert any new nodes, but you can change the properties of the existing nodes to further restrict their possible values or behavior.
Before, with the Derived By property still set to Extension.
<xs:schema> <xs:element name="Root"> <xs:complexType> <xs:sequence> <xs:element name="ShippingAddress" type="GlobalAddrType" /> <xs:element name="BillingAddress"> <xs:complexType> <xs:complexContent mixed="false"> <xs:extension base="GlobalAddrType" /> </xs:complexContent> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="GlobalAddrType"> [Address structure defined globally here.] </xs:complexType> </xs:schema>
After switching the Derived By property from Extension to Restriction.
<xs:schema> <xs:element name="Root"> <xs:complexType> <xs:sequence> <xs:element name="ShippingAddress" type="GlobalAddrType" /> <xs:element name="BillingAddress"> <xs:complexType> <xs:complexContent mixed="false"> <xs:restriction base="GlobalAddrType"> [Duplicate of address structure now appears here, ready to be restricted with additional attributes, set using the properties of the relevant nodes in the schema tree.] </xs:restriction> </xs:complexContent> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="GlobalAddrType"> [Address structure defined globally here.] </xs:complexType> </xs:schema>