W3C home > Mailing lists > Public > public-xsd-databinding@w3.org > July 2006

ISSUE-67: using xsi:type to assert Type Substitution

From: Databinding Issue Tracker <dean+cgi@w3.org>
Date: Wed, 26 Jul 2006 23:43:21 +0000 (UTC)
To: public-xsd-databinding@w3.org
Message-Id: <20060726234321.362E8DAE79@w3c4-bis.w3.org>

ISSUE-67: using xsi:type to assert Type Substitution


Raised by: Paul Downey
On product: Basic

Pattern from Faisel Waris which employs xsi:type
to perform type substitution.

<complexType name="Part" > 
        <element name="Number" type="string" /> 

<complexType name="Assembly" /> 
                <element name="Part" type="tns:Part" minOccurs="0"
maxOccurs="unbounded" /> 

<element name="Assembly" type="tns:Assembly" /> 

This can be easily extended in an OO way as follows:

<complexType name="Part2" > 
    <extension base="tns:Part"> 
        <element name="Description" type="string" /> 

At runtime we can use "Type Substitution" as follows:

<Assembly xmlns="…" xmlns:tns="…" xmlns:xsi="…"> 
  <Part xsi:Type="tns:Part2"> 
            <Description> extended part </Description> 

Received on Wednesday, 26 July 2006 23:43:14 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 19:58:12 UTC