RE: Can I choose one simpleType in one element?

> -----Original Message-----
> From:	Kasahara, Miki [SMTP:Miki.Kasahara@getronics.com]
> Sent:	Monday, July 08, 2002 10:40 AM
> To:	W3C XML Schema Comments list
> Subject:	Can I choose one simpleType in one element?
> 
> 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!
> 
Very simple, see below...

> 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>
> 
<xs:element name='A'>
	<xs:simpleType>
		<xs:union memberTypes='alf num'/>
	</xs:simpleType>
</xs:element>

pvb

Received on Monday, 8 July 2002 17:36:05 UTC