W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2003

Re: Mixed content model handling in XML Schema

From: Jeni Tennison <jeni@jenitennison.com>
Date: Wed, 26 Nov 2003 09:57:18 +0000
Message-ID: <29-1529524871.20031126095718@jenitennison.com>
To: "Roy, Jaydeep" <Jaydeep.Roy2@sweetandmaxwell.co.uk>
Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>

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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:03 UTC