Re: [Moderator Action] non-deterministic error using substitutionGroup

chuck.han@autodesk.com writes:

> I am trying to use substutionGroup in the following context:
> 
>                <schema xmlns:foo="http://foo"  targetNamespace="http://f     
>  <!-- elements -->oo">
>       <element name="root">
>        <complexType>
>         <choice maxOccurs="unbounded">
>          <element ref="foo:FooParent"/>
>          <element ref="foo:Foo"/>
>         </choice>
>        </complexType>
>       </element>
>       <element name="FooParent" type="foo:FooParentType"/>
>       <element name="Foo" type="foo:FooType"
>      substitutionGroup="foo:FooParen     
>  <!-- complexTypes -->t"/>
>       <complexType name="FooParentType">
>        <attribute name="id" type="ID" use="optional"/>
>        <attribute name="idref" type="IDREF" use="optional"/>
>       </complexType>
>       <complexType name="FooType">
>        <complexContent>
>         <extension base="foo:FooParentType"/>
>        </complexContent>
>       </complexType>
>      </schema>
>      
> 
> 
> 
> XSV comes up with the following error:
> 
>                <schemaError char='23' line='8' phase='instance'
>      resource='file:/D:/Program Files/XSV/foo.xsd'>non-deterministic
>      content model for type None:
>      {http://foo}:Foo/{http://foo}:Foo</schemaError>
> 
> 
> when I try to validate it against the following data file:
> 
>                <root xmlns="http://foo"
>      xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
>      xsi:schemaLocation="http://foo foo.x
>  <Foo id="_100"/>sd">
>      </root>
> 
> I get no errors if I delete the:
> 
>                <element ref="foo:FooParent"/>
> 
> line from the "root" element.  Can you please explain the error?

Sorry, what don't you understand?  You have a choice group which
allows Foo or FooParent.  But Foo is declared to be in teh
substitution group headed by FooParent, so anywhere FooParent appears
in a contentModel this is equivalent to a choice between Foo and
FooParent, i.e. your model is in DTD language:

  <!ELEMENT root (Foo|(Foo|FooParent))*>

I hope it's clear that this violates the constraint [1] that you be
able to say for every element in an instance what part of the content
model it came from.

ht

[1] http://www.w3.org/TR/xmlschema-a/#cos-nonambig
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/

Received on Thursday, 18 January 2001 11:12:38 UTC