- From: Bharath Kumar Reddy T <bharathkr@huawei.com>
- Date: Fri, 30 Jan 2009 10:37:41 +0530
- To: xmlschema-dev@w3.org, 'George Cristian Bina' <george@oxygenxml.com>
- Cc: ashutosh_p@huawei.com, ranjit@huawei.com
- Message-id: <000601c98298$ae84abe0$3a12120a@china.huawei.com>
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 Friday, 30 January 2009 05:08:36 UTC