Kelvin, You're confusing elements with types. A substitution group lets 
you control the element used in a serialization. Subtyping (polymorphism) 
is an orthogonal concept.

Bert, The answer to your question is that there's nothing special to 
indicate that a property is polymorphic. You can always assign a subtype 
to a property. In that case, the XML serialization will include an 
xsi:type attribute to indicate the subtype:

<a><b xsi:type="SpecialB">...</b></a>

Frank.

"kelvin goodson" <[EMAIL PROTECTED]> wrote on 05/15/2007 06:10:36 
AM:

> Bert,
>    I think the file at
> https://svn.apache.
> 
org/repos/asf/incubator/tuscany/java/sdo/tools/src/test/resources/subgroup.
> xsddemonstrates
> what you want.
> Regards, Kelvin.
> 
> On 15/05/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >
> > Hi all,
> >
> > I've a general question concerning polymorphism and SDO.
> >
> > Suppose I have a type A that contains a link "b" of type B. There also
> > exists a subtype "SpecialB" which extends B.
> >
> > I interpret this link to be a polymorphic link, i.e. instances of this
> > link should be of type B or of a subtype of B.
> > This works fine when using the DataObject API (e.g. using the method
> > DataObject.createDataObject(Property property, Type type)).
> >
> > However I don't understand how this is mapped into XML/XSD.
> >
> > If I generate an XSD for type A, how do I express that the link 'b' is
> > polymorph?
> >
> > A straigtforward approach like
> >
> >         <xsd:complexType name="A">
> >                 <xsd:sequence>
> >                         <xsd:element name="b" type="B" maxOccurs="1"
> > minOccurs="0"></xsd:element>
> >                 ...
> >         ...
> >
> > states that the type of B should be exactly 'B' (at least according to 
my
> > incomplete XML knowledge :-).
> >
> > On the instance level,
> >
> >         <a><b>...</b></a>
> >
> > is an xml piece for an object of type A with a link to some b. How 
would
> > this look like in case the link is to a SpecialB instance?
> >
> >
> > So, my question is, how do polymorphic links work in an xml context?
> >
> > I hope this is clear.
> >
> >
> > Bert
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to