Jakub,
I cannot remember whether you have ever seen a reply, but with Castor it
is *not* possible to map a member of a Java class more than once.
In order to achieve what you wanted, I'd advise you to look into either
using an interface or a class hierarchy and let Castor decide how to go
about instantiating the correct classes based upon the XML content.
Regards
Werner
Jakub Milkiewicz wrote:
> Hi
> I would like to unmarshall my xml - xml from legacy system i have no way
> to change, using castor and i have big problem with field appearing
> twice in my mapping file.
> In my xml i have something like this:
> <shoppingCart>
> <personalOrder>
> <buyerSSID>
> <ammount/>
> </personalOrder>
> <companyOrder>
> <amount>
> </companyOrder>
> </shoppingCart>
>
> My shopping cart has one property:
> Order[] orders
> where
> order has following propertes:
> buyerSSID
> amount
>
> So, for both company order and personal order elements i would like to
> create Order object and then have it stored inside shoppingCart object.
> In my mapping file i have:
> <class name="ShoppingCart">
> <field name="orders" type="Order" collection="array" >
> <bind-xml name="personalOrder"></bind-xml>
> </field>
> <field name="orders" type="Order" collection="array" >
> <bind-xml name="companyOrder"></bind-xml>
> </field>
>
> During unmarshalling i get en error that The field orders appears twice
> in the descriptor ...
> I realize that during marshalling Castor could have a real problem with
> my mapping file but during unmarshalling everything should works: if
> engine finds comapnyOrder or personalOder create order and then add it ...
>
> Can anyone know if unmarshalling like can be done in Castor ??
> Or Maybe someone knows any workaround.
>
> I belive that gurus like Werner Guttmann can help me...
>
> I can not change my classes and can not change my xml structure.
> Thanks for a help.
> Jakub Milkiewicz
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email