Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: "Michael Kay" <mike@--------.--->
To: "'Wang, Zhuo'" <zhuo.wang@-----.--->, <xmlschema-dev@--.--->
Date: 1/25/2007 10:24:00 AM
 

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

	 

	<xs:schema> 
	         <xs:complexType name="One">
	                   <xs:sequence>
	                     <xs:element name="elem1" type="xs:string"
fixed="abc"/>
	                     <xs:element name="elem1" type="xs:string"
fixed="123"/>
	                   </xs:sequence>
	         </xs:complexType>
	</xs:schema>

	 

	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}
<http://www.w3.org/TR/xmlschema-1/#element_declarations#element_declarations
> , {attribute group definitions}
<http://www.w3.org/TR/xmlschema-1/#attribute_group_definitions#attribute_gro
up_definitions> , 

	{model group definitions}
<http://www.w3.org/TR/xmlschema-1/#model_group_definitions#model_group_defin
itions>  and {notation declarations}
<http://www.w3.org/TR/xmlschema-1/#notation_declarations#notation_declaratio
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
http://www.saxonica.com/


From Leo.Antoli@M... Thu Jan 25 12:16:51 2007
Received: from maggie.w3.org ([193.51.208.68])
	by 


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent