W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2002

Re: name conflict

From: Jeni Tennison <jeni@jenitennison.com>
Date: Thu, 28 Feb 2002 18:42:23 +0000
Message-ID: <47107388446.20020228184223@jenitennison.com>
To: "andrea Boriero" <aboriero@hoc.elet.polimi.it>
CC: xmlschema-dev@w3.org
Hi Andrea,

> i have a problem with name conflict, i do not understand if this
> schema document is valid or not:

I'm afraid that it isn't valid. The problems are where you identified

> <xs:sequence>
>   <xs:element name="d">
>     <xs:complexType />
>   </xs:element>
>   <xs:element name="a" type="xs:string"/>
>   <xs:choice>
>     <xs:element name="b" type="xs:string"/>
>     <xs:element name="a" type="xs:byte"/> <!-- is it legal ? -->
>     <xs:element name="a" type="xs:byte"/>
>   </xs:choice>
>   <xs:sequence>
>     <xs:element name="a"> <!-- and this ? -->
>       <xs:complexType />
>     </xs:element>
>   </xs:sequence>
> </xs:sequence>

Within any xs:sequence or xs:choice or xs:all (i.e. any model group),
all the elements, at whatever level, that have the same name *must*
have the same type. In the above, you have three different types for
the a elements:

  <xs:element name="a" type="xs:string" />
  <xs:element name="a" type="xs:byte" />
  <xs:element name="a"><xs:complexType /></xs:element>

This isn't allowed. You could alternatively declare all the a elements
as being of the type xs:anyType (which is the default if you don't
specify what type they are) -- that will enable them to hold strings,
bytes or nothing at all without any problems. But you can't say that
particular ones are strings, bytes or empty.



Jeni Tennison
Received on Thursday, 28 February 2002 13:42:47 UTC

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