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

Re: xsi:type in a complex type derived from an union

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 12 Jun 2001 17:19:24 +0100
To: sylvain.devillers@philips.com
Cc: <xmlschema-dev@w3.org>
Message-ID: <f5b7kyhr7qr.fsf@cogsci.ed.ac.uk>
sylvain.devillers@philips.com writes:

>     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 ? -->

No, sorry.  I don't think as it stands there's any way to achieve
this.

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 Tuesday, 12 June 2001 12:31:38 GMT

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