Complex Type: Elements That Contain Mixed Content

An element that contains both text and child elements is considered a complex type element. For example, the XML document declaration in the code snippet on the right indicates that the report element contains both text and the elements, firstname and lastname.

The code snippet on the right also declares the associated XML schema declaration. In this declaration, the complexType element indicates that the report element is a complex element. The mixed attribute indicates that the complexType element contains text and elements as content.

XML Document Declaration
------------------------------------------

  <report> Please confirm that
    <firstname>ABC</firstname>.
    <lastname>DEF</lastname> has completed the     course.
  </report>

XML Schema Declaration
------------------------------------------

  <xs:element name="report">
    <xs:complexType mixed="true">
      <xs:sequence>
        <xs:element name="firstname"         type="xs:string"/>
        <xs:element name="lastname"         type="xs:string"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

Click the Next button to continue.