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

Re: redefinition errors

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 08 Jan 2001 18:07:27 +0000
To: MarkH@i2.co.uk
Cc: xmlschema-dev@w3.org
Message-ID: <f5by9wlvrxc.fsf@cogsci.ed.ac.uk>
MarkH@i2.co.uk writes:

> I have an element <representation> with attribute "format" and want to force
> inclusion of <representaion format='VLVF'> followed by zero or more further
> <represenation> elements.

Not possible, sorry.  Attributes just aren't part of content models in 

> To do this I defined a general
> "anyRepresenationType" and use it to define a restricted
> "vlvfRepresentationType" which has "format" with use='fixed' and
> value='VLVF'.

Defining such types is of course fine, you just can't use them both as 
the type of elements with the same name in the same content model.

> Problem: XML Spy says its fine, but XSV warns about the redef when
> validating the schema, and errors about it when validating the instance. (At
> the second element def it complains "Error: illegal redeclaration of
> {None}:representation").
> The errors appear at this point...
>  <complexType>
>   <sequence>
>    <element name='vlvfRepresentationType'/>
>    <element name='anyRepresentationType' minOccurs='0'/>
>   </sequence>
>  <complexType>

There's nothing wrong with that -- but note those elements have no
type -- I suspect you actually have:

    <element name='representation' type='vlvfRepresentationType'/>
    <element name='representation' type='anyRepresentationType' minOccurs='0'/>

which is precisely what you can't have [1].

> p.s. Henry - thanks for the earlier pointer/help re import/include

You're welcome.


[1] http://www.w3.org/TR/xmlschema-1/#cos-element-consistent
  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 Monday, 8 January 2001 13:07:30 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:14:49 UTC