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

RE: Question about the unique element declaration inside the model groups

From: Michael Kay <mike@saxonica.com>
Date: Thu, 25 Jan 2007 10:24:18 -0000
To: "'Wang, Zhuo'" <zhuo.wang@intel.com>, <xmlschema-dev@w3.org>
Cc: "'Zhang, Hongjiang'" <hongjiang.zhang@intel.com>, "'Yu, Zhiqiang'" <zhiqiang.yu@intel.com>, "'Moog, Thomas H'" <thomas.h.moog@intel.com>
Message-ID: <00a701c7406a$f92103f0$6401a8c0@turtle>


	I meet a case when I do the schema testing, which as the following:


	         <xs:complexType name="One">
	                     <xs:element name="elem1" type="xs:string"
	                     <xs:element name="elem1" type="xs:string"


	There are two elements with the same name "elem1" and the same
target namespace
	inside the <xs:sequence>. Is this allowed? 

Yes, provided (a) that the elements have the same type, and (b) that you
don't violate the UPA constraint (which would be violated in this example if
the first element were optional). This example should be OK.


	I read the spec and get the description which says: 

	3.15.6 Constraints on Schemas as a Whole  

	Schema Component Constraint: Schema Properties Correct

	2 Each of the {type definitions}
<http://www.w3.org/TR/xmlschema-1/#type_definitions#type_definitions> ,
{element declarations}
> , {attribute group definitions}
up_definitions> , 

	{model group definitions}
itions>  and {notation declarations}
ns>  must not contain two or more 

	schema components with the same {name} and {target namespace}.


	I think this case violate this rule. 

These are local element declarations. The rule applies only to global
element declarations (<xs:element> as a child of <xs:schema>).

Michael Kay
Received on Thursday, 25 January 2007 10:24:29 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:11 UTC