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

List of numeric and enumerated values problem

From: Neil Bradley <neil.bradley@rubus.com>
Date: Thu, 5 Jul 2001 05:36:18 -0400 (EDT)
Message-ID: <502326F46B08D41191C400508B6D70C10208CB07@nvision01.rubus.com>
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>

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:29:43 GMT

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