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

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

http://www.w3.org/2005/06/tracker/databinding/issues/67

Raised by: Paul Downey
On product: Basic

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

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

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

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

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

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

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

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

http://lists.w3.org/Archives/Public/public-xsd-databinding/2006Jul/0014.html

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