Documentation Center

How to use mixed content

Using mixed content may cause problems unless you apply this attribute carefully.

Using mixed="true" can cause issues for Content Editor .

Sometimes you need to structure content to a stricter model, even though the schema cannot be changed. An example of this is where there is no text allowed within the section, and it should have a <title> and <paragraph>.

The solution is that you can configure the section node to behave as a mixed="false" element, therefore behaving more like a container. You can use further configuration, through template to automatically create the content.

An example of code that could cause problem for editing

The following XML is an example of what might not work well in Content Editor , editing wise.

For the schema definition:

<xs:element name="section" mixed="true">
  <xs:complexType>
    <xs:choice minOccurs="0">
      <xs:element name="title" type="xs:string"/>
      <xs:element name="paragraph" type="p.type" maxOccurs="unbounded"/>
    </xs:choice>
  </xs:complexType>
</xs:element>

...

Can cause the following XML:

<section>
  some text about something, with some <b>bold text</b> and then
    <paragraph>
      more text
    </paragraph>
</section>

The <paragraph> in the example behaves as an inline element, similar to bold and italic, being inline with text. This can be confusing to Content Editor , since Content Editor will have a difficult time to split paragraphs, list items and show other strange behavior when editing.