W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2001

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

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 18 Jan 2001 16:12:18 +0000
To: chuck.han@autodesk.com
Cc: xmlschema-dev@w3.org
Message-ID: <f5bbst4j0v1.fsf@cogsci.ed.ac.uk>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:19 GMT