Re: Mixed content model handling in XML Schema

Hi Jaydeep,

> DTD's do not support mixed content models - Does XML schema handle
> mixed content model?

DTDs do support mixed content models, although you can't say anything
about the ordering of the elements that appear within the mixed
content. For example:

  (#PCDATA | em | strong | ...)*

XML Schema supports mixed content models as well. In this case, you
specify an element content model in the same way as you would
normally, and then use a flag to indicate that the content is mixed
(that text can appear anywhere amongst the elements in the content).
For example:

<xs:complexType name="name" mixed="true">
  <xs:all>
    <xs:element name="givenName" type="xs:token" />
    <xs:element name="familyName" type="xs:token" />
  </xs:all>
</xs:complexType>

means that elements of the type 'name' must contain a <givenName> and
a <familyName> element in any order, with any text before, after or
between them.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Wednesday, 26 November 2003 04:57:41 UTC