Sorry, I misunderstood.. you're right, what I said applies to the
unmarshalling process.

In the marshalling direction, you will need to create a new wrapper class
(used only for JiBX) that references both the player and the club. Then for
your list specify an "iter-method" that generates instances of this wrapper
class (which you have defined a mapping for) that wrap the individual Player
instances.

For unmarshalling, you can also use the wrapper class, by having an
"add-method" that does the unwrapping (and possibly checks for
inconsistency).

-Archie

On Tue, Sep 21, 2010 at 10:37 AM, Miguel <mig...@almeida.at> wrote:

>  Hi Archie,
>
> I am sorry, I don't follow you. Just to be sure, the problem here is
> creating the XML (not the unmarshalling) with a constant "name" field in
> each player, which comes from club.name.
>
> I don't see how your reply answers this, can you explain further please?
>
> Thank you,
>
> Miguel
>
>
> On Tue, 2010-09-21 at 10:18 -0500, Archie Cobbs wrote:
>
> You specify a factory method for creating each player that takes an Object
> parameter which you then cast to type Club.
>
> See the description for the "factory" 
> attribute<http://jibx.sourceforge.net/binding/binding-attributes.html#object>for
>  details.
>
> -Archie
>
>  On Tue, Sep 21, 2010 at 6:08 AM, Miguel <mig...@almeida.at> wrote:
>
>  Hi,
>
> My issue is best described with an example. The question is: in the
> following code, how can I replace HOWTOGETTOPARENTOBJECT? in the binding so
> that I get parentBindingField.name, knowing that Player doesn't have a Team
> field:
>
> <club>
>   <name> Liverpool </name>
>
>   <squad>
>     <player>
>       <team>Liverpool</team>
>       <name>Joe Cole</name>
>     </player>
>     <player>....</player>
>   </squad>
> </club>
>
>
> Java:
> Club{
> String name;
> List players
> }
>
> Player{
> String playerName;
> }
>
>
> Jibx binding:
> <binding>
> <mapping class="Team">
> <collection name="squad" usage="optional" field="players"
> create-type="java.util.ArrayList">
> <value name="squad" field="HOWTOGETTOPARENTOBJECT? I want team.namehere!"/>
> <value name="name" field="name"/>
> </collection>
> </mapping>
> </binding>
>
> Thank you in advance,
>
> Miguel Almeida
>
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>
>
>
> --
> Archie L. Cobbs
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________ jibx-users mailing list 
> jibx-users@lists.sourceforge.net 
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>


-- 
Archie L. Cobbs
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to