You want to use abstract mappings:
http://jibx.sourceforge.net/tutorial/binding-mappings.html
Something like
<mapping class="CompanyName" abstract="true">
<value style="attribute" name="name" field="name"/>
<value style="attribute" name="code" field="code"/>
</mapping>
Then the reference would be something like
<structure name="AgencyName" field="company"/>
where "company" is an ivar of type CompanyName
Steve
On Tue, 1 Jul 2008, gufux wrote:
Hi all,
I've read in the archive that it's possible to define multiple <mapping> for the
same class with different element names *if* the direction of binding is *only*
input.
I've tried but there are errors and I think it's impossible....
I have for example this class
CompanyName {
String name;
String code;
}
and I want to bind this class to 2 different elements: <CompanyName> and
<AgencyName> (only the element name change)
---------- XML -----------------
.......
<CompanyName name="IBMC" code="1" />
<AgencyName name="IBMA" code="2">
......
----------------------------------
so the binding with *global mapping*:
-------------- BINDING -------------------------------
<binding direction="input">
<!-- COMPANY NAME -->
<mapping name="CompanyName" class="test.CompanyName">
<value name="name" field="name" style="attribute" />
<value name="code" filed="code" style="attribute" />
</mapping>
<!-- AGENCY NAME -->
<mapping name="AgencyName" class="test.CompanyName">
<value name="name" field="name" style="attribute" />
<value name="code" filed="code" style="attribute" />
</mapping>
</binding
----------------------------------------------------------------
So It's correct that also with direction binding to input is impossible to
define multiple mappings for the same class with different elements names??
Thank you
Davide.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users