I looked into that. But I'm not sure that it'll work, because I'm
reusing a mapping for a class in a Collection, so I don't know where
to put the label when "instantiating" the collection:
<collection field="info" item-type="Hazards/> <--- I want to
change "Haz" to "Info"
<collection field="stuff" item-type="Hazards/> <--- I want to
change "Haz" to "Stuff"
...
<mapping name="Haz" class="Hazards">
<value name="Name" get-method="getName" set-method="setName"/>
<value name="Type" get-method="getType" set-method="setType"/>
</mapping>
-------
My solution was to create another java class that was just an
extension of the original class. I don't like that solution, but I'm
not sure how to use the label approach for collections, and JiBX
wouldn't let me map to the same class twice.
On Fri, 24 Sep 2004 07:09:58 -0700, Dennis Sosnoski <[EMAIL PROTECTED]> wrote:
> Currently you can do this with label/using
> (http://jibx.sourceforge.net/tutorial/binding-advanced.html#label), by
> adding a label attribute for the mapping definition and then having a
> <structure> element reference it with a different name. That's a fairly
> ugly approach, though. The beta 4 release is replacing this with a
> cleaner approach using a <template> element that allows flexible reuse
> of portions of the binding definition.
>
> - Dennis
>
>
>
> Bao Trang wrote:
>
> >I've got several places where I want to re-use a mapping, but I want
> >to change the name of the element tag on a case-by-case basis. I
> >haven't been able to do that so far. Here's an example:
> >
> ><mapping name="Name1" class="CollectionClass">
> > <value name="name" field="field">
> ></mapping>
> ><mapping name="Root" class="RootClass">
> > <structure name="A">
> > <collection field="a" class="CollectionClass">
> > </structure>
> > <structure name="B">
> > <collection field="b" class="CollectionClass">
> > </structure>
> ></mapping>
> >
> >My result would be something like this:
> ><Root>
> > <A>
> > <Name1>
> > <name/>
> > </Name1>
> > </A>
> > <B>
> > <Name1>
> > <name/>
> > </Name1>
> > </B>
> ></Root>
> >
> >
> >I want to change the "Name1" tag to something specific like so:
> ><Root>
> > <A>
> > <AName1>
> > <name/>
> > </AName1>
> > </A>
> > <B>
> > <BName1>
> > <name/>
> > </BName1>
> > </B>
> ></Root>
> >
> >Any ideas on how to do this?
> >
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
> Project Admins to receive an Apple iPod Mini FREE for your judgement on
> who ports your project to Linux PPC the best. Sponsored by IBM.
> Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
> _______________________________________________
> jibx-users mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users