W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > July to September 2002

Can I choose one simpleType in one element?

From: Kasahara, Miki <Miki.Kasahara@getronics.com>
Date: Mon, 08 Jul 2002 11:39:47 -0600
Message-Id: <5.1.0.14.1.20020708113944.00afd990@localhost>
To: W3C XML Schema Comments list <www-xml-schema-comments@w3.org>





We define some  common simpleTypes because we will use them
several times in XMLs. and I would like to choose one simpleType
between common simpleType in one tag(element).

If you know some  answers, please advice me!

ex)
==================
in XML, it will be...
------------------
<A>abcde</A>           <!-- 6 small character -->
------------------
OR
------------------
<A>1234567890</A>      <!-- 10 number -->
------------------

==================
in schema, I would like to choose several simpleTypes.
==================

<xs:element name="A">
    <!-- WE WOULD LIKE TO CHOOSE TYPE -->
      CHOOSE
         REF="alf simpleType"
           OR
         REF="num simpleType"
</xs:element>


<!-- "alf" simpleType -->
<xs:simpleType name="alf">
     <xs:restriction base="xs:string">
         <xs:pattern value="[a-z]{6}"/>
     </xs:restriction>
</xs:simpleType>

<!-- "num" simpleType -->
<xs:simpleType name="num">
     <xs:restriction base="xs:string">
         <xs:pattern value="[0-9]{10}"/>
     </xs:restriction>
</xs:simpleType>


Thank you!
miki kasahara



-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Miki Kasahara
http://jp.getronics.com/
Professional ServiceDivision
e-Solutions Development Department
Getronics Japan, LTD
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
Received on Monday, 8 July 2002 13:50:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:13:01 GMT