RE: List of numeric and enumerated values problem

Hi Neil,

Create a union of the two types Score and NoScore, then create a list of the
union.

<X:simpleType name="ScoreAndNoScore">
  <X:union memberTypes="A:Score A:NoScore"/>
</X:simpleType>

<X:simpleType name="ScoreAndNoScoreList">
  <X:list itemType="A:ScoreAndNoScore"/>
</X:simpleType>


That should give you what you want.

Priscilla Walmsley
Vitria Technology

> -----Original Message-----
> From: xmlschema-dev-request@w3.org
> [mailto:xmlschema-dev-request@w3.org]On Behalf Of Neil Bradley
> Sent: Thursday, July 05, 2001 5:36 AM
> To: 'xmlschema-dev@w3.org'
> Subject: List of numeric and enumerated values problem
>
>
>
> I am trying to create a list type that allows scores, which are values
> between 5 and 50, to be created, such as '50 23 9 22', and
> mixed with a the
> keyword 'none' to represent no score. For example, '23 none 5
> 7 none 45':
>
> First I defined the Score type allowing such scores as '23':
>
> <X:simpleType name="Score">
>   <X:restriction base='X:integer'>
>     <X:maxInclusive value='50'/>
>     <X:minInclusive value='5'/>
>   </X:restriction>
> </X:simpleType>
>
> Then I create a list type for score, ScoreList, so allowing
> '50 23 22 9':
>
> <X:simpleType name="ScoreList">
>   <X:list itemType="A:Score"/>
> </X:simpleType>
>
> Then I create the NoScore type, which allows the keyword 'none' only:
>
> <X:simpleType name="NoScore">
>   <X:restriction base='X:NMTOKEN'>
>     <X:enumeration value='none'/>
>   </X:restriction>
> </X:simpleType>
>
> Then I create a list for type NoScore, called NoScoreList, so
> allowing 'none
> none none':
>
> <X:simpleType name="NoScoreList">
>   <X:list itemType="A:NoScore"/>
> </X:simpleType>
>
> Finally, I try to create union of the two list types, so I
> can have '23 none
> 5':
>
> <X:simpleType name="ScoreAndNoScore">
>   <X:union memberTypes="A:ScoreList A:NoScoreList"/>
> </X:simpleType>
>
> But it does not work. I can have 'none none none', or '5 6 7', but no
> combination of the two
>
> I thought maybe I should create a new list type, but the
> following addition
> causes an error:
>
> <X:simpleType name="ScoreAndNoScoreList">
>   <X:list itemType="A:ScoreAndNoScore"/>
> </X:simpleType>
>
> Any ideas how to do this?
>
> Neil.
>
>
>
>
>

Received on Thursday, 5 July 2001 09:58:46 UTC