W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2004

RE: Schema Component Constraint: Element Declarations Consistent

From: Biron,Paul V <Paul.V.Biron@kp.org>
Date: Fri, 13 Feb 2004 09:05:13 -0800
Message-Id: <8904C60CACA7D51191BC00805FEAAF430117280E@crdc-exch-7.crdc.kp.org>
To: xmlschema-dev@w3.org
> -----Original Message-----
> From: Michael Kay [mailto:mhk@mhk.me.uk] 
> Sent: Friday, February 13, 2004 8:43 AM
> To: xmlschema-dev@w3.org
> Subject: Schema Component Constraint: Element Declarations Consistent
> 
> In the rule for consistency of element declarations within a 
> model group, why is it required that the type of an element 
> that appears twice be a named top-level type?
> 
> But the following is not:
> 
> <complexType name="cType">
>  <sequence>
>   <element ref="a"/>
>   <element ref="a"/>
>  </sequence>
> </complexType>
> 
> <element name="a">
>  <complexType>
>    <simpleContent base="xs:string"/>
>  </complexType>
> </element>

I'm sure henry can give a more precise explanation, but the above seems to me to be correct (which is backed up by xsv 2.6.2 and xerces 2.6.1).  I think the reason that the above does not run afould of the Element Declaration Consistent [1] schema constraint is that the use of element _references_ in the model group in question means that, in fact, there is only one element declaration involved here...so that constraint never comes into question.

I'd note that the following is in violation:

<xs:complexType name="cType">
 <xs:sequence>
  <xs:element name="a">
   <xs:complexType>
    <xs:simpleContent>
     <xs:extension base="xs:string"/>
    </xs:simpleContent>
   </xs:complexType>
  </xs:element>
  <xs:element name="a">
   <xs:complexType>
    <xs:simpleContent>
     <xs:extension base="xs:string"/>
    </xs:simpleContent>
   </xs:complexType>
  </xs:element>
 </xs:sequence>
</xs:complexType>

[which, BTW, corrects a type in your original example]

since the 2 "a" elements in the model do in fact have separate (but equal :-) definitions.

pvb
Received on Friday, 13 February 2004 12:08:27 GMT

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