Re: non-deterministic content model using groups

Hi Richard,

> Could someone tell me why the schema below exhibits a
> non-deterministic content model for any of the elements in the
> "audio" or "video" groups?

Group references are automatically resolved, so as far as a validator
is concerned, the content model is exactly the same as:

  <xs:sequence>
    <xs:sequence>
      <xs:choice>
        <xs:all>
          <xs:element name="relationship" type="xs:string" />
          <xs:element name="url" type="xs:string" />
          <xs:element name="speed" type="xs:integer" />
          <xs:element name="headline" type="xs:string" />
        </xs:all>
        <xs:all>
          <xs:element name="relationship" type="xs:string" />
          <xs:element name="url" type="xs:string" />
          <xs:element name="kicker" type="xs:string" />
          <xs:element name="headline" type="xs:string" />
        </xs:all>
      </xs:choice>
    </xs:sequence>
  </xs:sequence>

There are several things wrong with this content model. The main one
is actually that you can't use xs:all as particles within other model
groups. But even if they were sequences instead, it would be
non-deterministic. When a validator encountered a 'relationship'
element, it wouldn't be able to tell whether it was the 'relationship'
element from the first choice or the second choice, so it wouldn't
know which model group it was supposed to be looking at.

To make it non-deterministic, you need the content model, after
resolution of the group references, to look something like:

  <xs:sequence>
    <xs:element name="relationship" type="xs:string" />
    <xs:element name="url" type="xs:string" />
    <xs:choice>
      <xs:element name="speed" type="xs:integer" />
      <xs:element name="kicker" type="xs:string" />
    </xs:choice>
    <xs:element name="headline" type="xs:string" />
  </xs:sequence>

Cheers,

Jeni

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

Received on Wednesday, 1 May 2002 05:29:09 UTC