Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XML Schema Complex Types – Mixed Content

XSD Mixed Content


A mixed complex type can contain attributes, elements, and text.


Complex Type with Mixed Content

The XML element, "letter", contains text as well as other elements:

  Dear Mr.John Smith.

  Your order 1032

  will be shipped on 2001-07-13.

The following schema declares this "letter" element:

 

    xs:sequence

     

     

     

   

 

Note: In order for character data to appear between the child elements of "letter", the mixed attribute must be set to "true".xs:sequence The tags (name, orderid, and shipdate) mean that the defined elements must appear in sequence inside the "letter" element.

We can also give the complexType element a name and let the type attribute of the "letter" element refer to this complexType name (by this method, several elements can refer to the same complex type):

  xs:sequence