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

Determining cardinality of a simple type

From: Paul Erion <p_erion@yahoo.com>
Date: Wed, 24 Jul 2002 12:04:04 -0700 (PDT)
Message-ID: <20020724190404.89708.qmail@web10705.mail.yahoo.com>
To: xmlschema-dev@w3.org

Is it possible to derive the cardinality of a "simpleType" that I can
then apply to an element's minOccurs/maxOccurs attributes?

For example, the following simple type has a cardinality of 4 (I'm new
to schemas, so please feel free to correct me if I use any
schema-specific terms incorrectly)

  <xsd:simpleType  name="nameType">
    <xsd:restriction  base="xsd:string">
      <xsd:enumeration  value="bob" />
      <xsd:enumeration  value="carol" />
      <xsd:enumeration  value="ted" />
      <xsd:enumeration  value="alice" />
    </xsd:restriction>
  </xsd:simpleType>

and I would like to specify that the "swingers" element will have
exactly 4 "person" elements as children.

  <xsd:element  name="swingers">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="person" minOccurs="4" maxOccurs="4" />
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

but I'd like to somehow state that minOccurs/maxOccurs is equal to the
cardinality of "nameType" -- that is, without explicitly using '4'. 
This isn't a critical thing, but it would be nice if when I add another
value to "nameType", I don't have to remember to modify the
minOccurs/maxOccurs values.

Thanks,

:Paul

__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com
Received on Wednesday, 24 July 2002 15:04:05 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:04 UTC