Georg,
what does your mapping file look like right now ? How have you tried to
map A and Bs ?
Having said that, I guess this might be achievable, but I am not 100%
sure. Basically, you will have to use the container attribute (set to
false) on the class mapping for 'B', so that no <B> tags will be
rendered. Whether this will work with your additional requirement on the
aggregation by the value of the id attribute of B, not sure.
Regards
Werner
Georg Federmann wrote:
> Hi all,
>
> I need to marshal a given object model to a given xml, but I can't persuade
> Castor to do as needed.
> This is the problem:
> I have two java types A and B where B has a field "id" and A holds
> references to B. Now I need the field "id" of B as an attribute of the xml
> element <a>, that represents A.
>
> class A{
> B[] field;
> }
>
> class B{
> String id;
> int value;
> }
>
> a collection of objects of type A shall be marshalled to some xml like this:
>
> <data>
> <a id="b1">
> <value>15</value>
> <value>8</value>
> </a>
> <a id="b2">
> <value>12</value>
> <value>17</value>
> <value>8</value>
> <value>3</value>
> </a>
> </data>
>
> Somehow I can't see, how I can split the fields of the B type into an
> attribute "id" of the <a> element and a child element <value> of the <a>
> element.
>
>
> I appreciate any help
>
> best regards, Georg
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email