- From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
- Date: 02 Feb 2001 12:07:33 +0000
- To: Ayalew Kassahun <A.Kassahun@InfoRay.NL>
- Cc: xmlschema-dev@w3.org, Michael Anderson <michael@research.canon.com.au>
Ayalew Kassahun <A.Kassahun@InfoRay.NL> writes:
> Hi List, Mick,
>
> None of the three scenarios are answer to my question. My question is that I
> want to specify in the schema that the allowed simple times (not only for
> age but for all simple types in my docs) are xsd:int, xsd:string or
> xsd:data. If there is anything which is of a simpleType then it must be one
> of the above three types.
>
> I was think of in this lines:
>
> In my schema ...
>
> <xsd:simpleType name="mySimpleType">
> <xsd:simpleType>
> <xsd:union memberTypes="xsd:short xsd:integer xsd:double"/>
> </xsd:simpleType>
> </xsd:simpleType>
Fine.
> then I want to use mySimpleType for whatever simple type ...
>
> In my docs, for example:
>
> <!-- age is a mySimpleType, it can be given as int, double or as string -->
> <xsd:element name="age">
> <myNS:mySimpleType>
> </xsd:simpleType>
> </xsd:element>
Use the 'type' attribute to give an element an existing type:
<xsd:element name="age" type="myNS:mySimpleType/>
> <!-- weight is a mySimpleType, it can only be a double -->
> <xsd:element name="weight">
> <myNS:mySimpleType>
> <xsd:restriction base="xsd:double"/>
> </xsd:simpleType>
> </xsd:element>
There is currently no way to derive a type from a union type by
subsetting its member types. So the best you can do is
<xsd:element name="weight" type="xsd:double"/>
ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
W3C Fellow 1999--2001, part-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
Received on Friday, 2 February 2001 07:07:36 UTC