Home >Online Product Documentation >Table of Contents >Defining complexTypes That Mix Data and Elements
Suppose you want to define a complexType that mixes elements and data. For example, you have an XML document with contents such as the following:
<letter><salutation> Dear Mr. <name>Robert Smith</name> , </salutation> Your order of <quantity>1 </quantity> <productName>Baby Monitor </productName> shipped from our warehouse on <shipDate>2001-04-21</shipDate> . </letter>
<salutation> Dear Mr. <name>Robert Smith</name> , </salutation> Your order of <quantity>1 </quantity> <productName>Baby Monitor </productName> shipped from our warehouse on <shipDate>2001-04-21</shipDate> .
The letter element and salutation element have element and data children. You must define complexTypes for both the letter and the salutation elements. Their Mixed property value must be set to true. The Mixed property is the one that allows an element to contain both elements (<shipDate>, for example) and raw data (Dear Mr. for example) as children.
letter
salutation
true
<shipDate>
Dear Mr.
This section describes how to achieve this using both the Diagram and Tree views.