- From: Michael Kay <mike@saxonica.com>
- Date: Thu, 29 Jan 2009 11:17:08 -0000
- To: "'Bharath Kumar Reddy T'" <bharathkr@huawei.com>, <xmlschema-dev@w3.org>, "'George Cristian Bina'" <george@oxygenxml.com>
- Cc: <ashutosh_p@huawei.com>, <ranjit@huawei.com>
- Message-ID: <D48D58A9DF5946FD8B8E111A94095BA6@Sealion>
The definition of "substitution group" is already recursive.
Michael Kay
_____
From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On
Behalf Of Bharath Kumar Reddy T
Sent: 29 January 2009 11:03
To: xmlschema-dev@w3.org; 'George Cristian Bina'
Cc: ashutosh_p@huawei.com; ranjit@huawei.com
Subject: Particle restriction validity (elements with substitution group
affiliation)
Hi..
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"
substitutionGroup="d"/>
<xs:element name="d" type="xs:anyType"/>
<xs:complexType name="base">
<xs:sequence>
<xs:element ref="d"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="derived">
<xs:complexContent>
<xs:restriction base="base">
<xs:sequence>
<xs:choice>
<xs:element ref="c"/>
</xs:choice>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:element name="doc" type="base"/>
</xs:schema>
My doubt: d --- choice of d and c.
should i take the above c as a choice of b and c again
recursively???
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
type.
Can you please tell me whether i should take the choice group recursively or
not???
Thanks and Regards,
Bharath.
Received on Thursday, 29 January 2009 11:17:48 UTC