W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2001

Re: multiple type definitions for elements with the same name

From: Eddie Robertsson <eddie@allette.com.au>
Date: Fri, 08 Jun 2001 09:57:06 +1000
Message-ID: <3B2014D1.B9A64122@allette.com.au>
To: Kohsuke KAWAGUCHI <kohsukekawaguchi@yahoo.com>
CC: Noel Bush <noel@alicebot.org>, xmlschema-dev@w3.org
Hi all,

See inline comments on the solution.

> While I agree that Noel can't get what he wants, (she? I'm sorry. I'm
> not good at telling the gender from the name..),  the problem is not
> because of the so-called "co-constraints".
>
> But I think XML Schema can be abused to better model Noel's language.
> How about this?
>
> <!-- make it a "ur-type" and abstract -->
> <simpleType name="conditionType" abstract="true" />

I think this should be a complexType and not a simpleType.

> <complexType name="conditionType.single">
>   <simpleContent>
>     <extension base="conditionType">
>       <attribute name="gender" ... />
>     </restriction>
>   </simpleContent>
> </complexType>
>
> <complexType name="conditionType.list">
>   <complexContent>
>     <extension base="conditionType">
>       <sequence>
>         <!-- use local element declaration so that you can define
>               li for different purposes later -->
>         <element name="li" maxOccurs="unbounded">
>           <complexType>
>             <simpleContent>
>               <extension base="string">
>                 <attribute name="gender" ... />
>                 <attribute name="name" ... />
>               </extension>
>             </simpleContent>
>           </complexType>
>         </element>
>       </sequence>
>     </extension>
>   </complexContent>
> </complexType>
>
> .. and so on...
>
> <element name="condition">
>   <complexType ref="conditionType"/>
> </element>

This should be:
<element name="condition" type="conditionType"/>

Also, I think it's worth mentioning that you have to specify the xsi:type
attribute in the instance document to use this approach.

Cheers,
/Eddie

> But certainly you can't capture the "default list condition".
>
> Also, you may want to check out different languages like RELAX, TREX, or
> RELAX NG. Things like this are as easy as ABC.
>
> regards,
> ----------------------
> K.Kawaguchi
> E-Mail: kohsukekawaguchi@yahoo.com
Received on Thursday, 7 June 2001 19:56:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:21 GMT