W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2003

Re: Possible XMLSchema for data value

From: Jeni Tennison <jeni@jenitennison.com>
Date: Tue, 7 Jan 2003 15:08:15 +0000
Message-ID: <1733427218.20030107150815@jenitennison.com>
To: "Avin Patel" <vze49rz3@verizon.net>
CC: "xmlschema" <xmlschema-dev@w3.org>

Hi Avin,

> Actually I want to write following value:
> <size><medium/></size>
> or
> <size><large/></size>
> or
> <size><small/></size>
> or
> <size>15</size>
> So value would be integer value or empty elements: <large/>,
> <medium/>, <small/>

That's impossible in W3C XML Schema unless you introduce xsi:type
attributes to indicate the kind of <size> element that's being used.
Would you be happy with:

  <size>medium</size> or
  <size>large</size> or
  <size>small</size> or

This would be easy to do using a union type:

  <xs:element name="size">
      <xs:union memberTypes="xs:integer">
          <xs:enumeration value="large" />
          <xs:enumeration value="medium" />
          <xs:enumeration value="small" />


P.S. It's simple in RELAX NG:

  <element name="size">
      <element name="medium">
        <empty />
      <element name="large">
        <empty />
      <element name="small">
        <empty />
      <data type="integer" />

Jeni Tennison
Received on Tuesday, 7 January 2003 10:08:19 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:59 UTC