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

Particle restriction validity (elements with substitution group affiliation)

From: Bharath Kumar Reddy T <bharathkr@huawei.com>
Date: Thu, 29 Jan 2009 16:33:29 +0530
To: xmlschema-dev@w3.org, 'George Cristian Bina' <george@oxygenxml.com>
Cc: ashutosh_p@huawei.com, ranjit@huawei.com
Message-id: <001d01c98201$3826b9d0$3a12120a@china.huawei.com>
According to the constraints for restriction of a type definition, in the
specification http://www.w3.org/TR/xmlschema-1/#cos-particle-restrict, it is
given that 
2.1 Any top-level element declaration particle (in R or B) which is the
<http://www.w3.org/TR/xmlschema-1/#class_exemplar> {substitution group
affiliation} of one or more other element declarations and whose
<http://www.w3.org/TR/xmlschema-1/#key-eq> .substitution group. contains at
least one element declaration other than itself is treated as if it were a
choice group whose  <http://www.w3.org/TR/xmlschema-1/#p-min_occurs> {min
occurs} and  <http://www.w3.org/TR/xmlschema-1/#p-max_occurs> {max occurs}
are those of the particle, and whose
<http://www.w3.org/TR/xmlschema-1/#particles> {particles} consists of one
particle with  <http://www.w3.org/TR/xmlschema-1/#p-min_occurs> {min occurs}
and  <http://www.w3.org/TR/xmlschema-1/#p-max_occurs> {max occurs} of 1 for
each of the declarations in its  <http://www.w3.org/TR/xmlschema-1/#key-eq>
.substitution group..
so, In the following schema, "d" of base is a choice of "d" and "c". and "C"
of derived is a choice of c and b. 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <xs:element name="a" type="xs:anyType" substitutionGroup="b"/>
 <xs:element name="b" type="xs:anyType" substitutionGroup="c"/>
 <xs:element name="c" type="xs:anyType" block="substitution"
 <xs:element name="d" type="xs:anyType"/>

 <xs:complexType name="base">
   <xs:element ref="d"/>

 <xs:complexType name="derived">
   <xs:restriction base="base">
      <xs:element ref="c"/>
 <xs:element name="doc" type="base"/>

My doubt: d --- choice of d and c.
                      should i take the above c as a choice of b and c again
But spec. says that the top level element declaration (in R or B) only can
be considered as choice group. 
So, recursion will not be applied since C  is not referenced again in base
Can you please tell me whether i should take the choice group recursively or
Thanks and Regards,

Received on Thursday, 29 January 2009 11:04:25 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:50 UTC