Hello
Is there any way to bind two XML elements (Bbb and Ccc) to the same java
field...???
I'm trying to obtain a polymorphic data structure using castor XML
Mapping....
The example below fails, but illustrates what I'm attempting to do......
Any assistance or pointers greatly appreciated...
Cheers
Mark
------------------------------
-- Java Objects
------------------------------
Class Aaa {
String name;
String desc;
}
Class Bbb extends Aaa {
String blah;
}
Class Ccc extends Aaa {
String fooo;
}
Class Abba {
Collection aaa; //contains descendants of Aaa ie Bbb | Ccc
}
-----------------------------
-- XML
------------------------------
<Abba>
<Bbb>
<name>bbb name</name>
<desc>bbb desc</desc>
<blah>bbb blah</blah>
</Bbb>
<Ccc>
<name>ccc name</name>
<desc>ccc desc</desc>
<fooo>ccc fooo</fooo>
</Ccc>
</Abba>
-------------------------------
-- Mapping
------------------------------
<mapping>
<class name="test.Abba">
<map-to xml="Abba"/>
<field name="aaa" type="test.Bbb" collection="collection">
<bind-xml name="Bbb"/>
</field>
<field name="aaa" type="test.Ccc" collection="collection">
<bind-xml name="Ccc"/>
</field>
</class>
<class name="test.Aaa">
<field name="name" type="string">
<bind-xml name="name" node="element"/>
</field>
<field name="desc" type="string">
<bind-xml name="desc" node="element"/>
</field>
</class>
<class name="test.Bbb" extends="test.Aaa">
<field name="blah" type="string">
<bind-xml name="blah" node="element"/>
</field>
</class>
<class name="test.Ccc" extends="test.Aaa">
<field name="fooo" type="string">
<bind-xml name="fooo" node="element"/>
</field>
</class>
</mapping>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev