RE: List of numeric and enumerated values problem

Hi,

Yes, I thought that would work too, though the spec seemed a bit vague about
this, and Xerces 1.4.1 could not handle it! It complains that "no circular
definitions are allowed"!

Neil.


-----Original Message-----
From: Priscilla Walmsley [mailto:priscilla@walmsley.com]
Sent: 05 July 2001 14:59
To: 'Neil Bradley'; xmlschema-dev@w3.org
Subject: 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 Saturday, 7 July 2001 09:30:48 UTC