W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2001

xsi:type in a complex type derived from an union

From: <sylvain.devillers@philips.com>
Date: Mon, 11 Jun 2001 18:11:11 +0200
To: <xmlschema-dev@w3.org>
Message-ID: <0056900018477636000002L062*@MHS>
    Hello all,

I wish to derive a simple type by extension to add an attribute. This
simple type is itself a union.

My question is : can I override the element type in the instance with
the "xsi:type" attribute ?

Example:
Schema
 <xsd:element name="anElement">
  <xsd:complexType>
   <xsd:simpleContent>
    <xsd:extension base="intOrString">
     <xsd:attribute name="anAttribute" type="xsd:int"/>
    </xsd:extension>
   </xsd:simpleContent>
  </xsd:complexType>
 </xsd:element>

 <xsd:simpleType name="intOrString">
  <xsd:union memberTypes="xsd:int xsd:string"/>
 </xsd:simpleType>

Instance:
 <anElement anAttribute="1" xsi:type="string">
    something
 </anElement>
 <!-- Is the "xsi:type" attribute legal ? -->


Thank you,

    Sylvain

---------------------------------------------------------
Sylvain Devillers, Senior Scientist
Laboratoires d'Electronique Philips (LEP)
Postal address until 26/06:
22, avenue Descartes, F-94453 Limeil-Brevannes, France
+33 (0)1 45 10 67 55
Sylvain.Devillers@philips.com
---------------------------------------------------------
Received on Monday, 11 June 2001 11:57:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:21 GMT