Home > Articles > Web Services > XML

  • Print
  • + Share This
From the author of

Mixed Content

A complex type can specify mixed content. Mixed content means that an element whose element type's structure type is this complex type can contain text interspersed with elements. The text is always free form (there is no way to specify constraints on the text). The elements are typically partially confined, as would be the case in normal complex content. The following catalogEntryDescriptionType permits valid lists of part numbers to be interspersed with text:






<xsd:complexType name="catalogEntryDescriptionType"
         mixed="true">
  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
    <xsd:element name="partList"
           type="partNumberListType"/>
  </xsd:sequence>
</xsd:complexType>

The XML representation of an element type whose structure type is catalogEntryDescription might look like the following element:

<xsd:element name="description"
       type="catalogEntryDescriptionType"/>

Given the preceding element type, the following description element is valid in an XML instance:

<description>
  This is made up of both
  <partList>UX002 UX003</partList>
  pieces which makes this assembly
  better than
  <partList>ASM2000</partList>
  and better than the competition.
</description>
  • + Share This
  • 🔖 Save To Your Account