W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 2002

Re: content model question

From: C. M. Sperberg-McQueen <cmsmcq@acm.org>
Date: Wed, 02 Oct 2002 20:17:11 -0600
Message-Id: <>
To: Steven Noels <stevenn@outerthought.org>
Cc: W3C XML Schema Comments list <www-xml-schema-comments@w3.org>

At 2002-10-02 13:08, Steven Noels wrote:
>Hi all,
>Due to the non-deterministic nature of XML Schema,

? I'm not sure what non-determinism you mean.  In XML Schema 1.0,
content models must be 'deterministic' in the sense used by
XML 1.0.

>I was wondering if it  is possible at all to define this model:
>Not allowed:
>Does anyone has an idea?

How about this?  It's the schema equivalent of ((b,c?) | (c,b?)), which
would be the DTD notation for this.

<xsd:schema targetNamespace="http://cmsmcq.com/testns"

  <xsd:element name="a" type="my:abc"/>
  <xsd:element name="b"/>
  <xsd:element name="c"/>

  <xsd:complexType name="abc">
     <xsd:element ref="my:b"/>
     <xsd:element ref="my:c" minOccurs="0" maxOccurs="1"/>
     <xsd:element ref="my:c"/>
     <xsd:element ref="my:b" minOccurs="0" maxOccurs="1"/>

The following instance illustrates that (according to xsv, at
least) this schema allows what you want it to allow, without
allowing empty 'a' elements.   You should get an error on the
final 'a' element; comment it out and the document is schema-valid.

<test xmlns="http://cmsmcq.com/testns">

I hope this helps.

Received on Wednesday, 2 October 2002 22:18:45 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:50:00 UTC