Re: multiple type definitions for elements with the same name

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 UTC