You will need a mapping for each of your inherited class types.

-------------------------------------------------------------------
Dan Cooperstock, Senior Software Developer, Quest Software
260 King St. E., Toronto ON Canada  M5A 4L5
[EMAIL PROTECTED]    416-933-5165
 
With Quest Software, you get more ... more performance, more
productivity, more value from your IT investments.

Visit www.quest.com to learn more.


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dees, Ian
(GE Healthcare)
Sent: Wednesday, December 13, 2006 2:06 PM
To: jibx-users@lists.sourceforge.net
Subject: [jibx-users] Dynamic Element Name?

Hi List,
 
In my Java object model, I have several objects (com.ge.tree.Oak,
com.ge.tree.Maple, com.ge.tree.Walnut, for example) that all use a
similar class com.ge.Wood for a field (lets call it woodType for this
example). When marshalling my XML out for this model, I would like to
change the name of the element that corresponds to the woodType field
depending on which subclass of com.ge.Wood the certain com.ge.tree class
uses.

In code:

class Oak implements com.ge.Tree {
   private Wood woodType = new OakWood(); } class Maple implements
com.ge.Tree {
   private Wood woodType = new MapleWood(); } class Walnut implements
com.ge.Tree {
   private Wood woodType = new WalnutWood(); }

In XML:
<oak>
   <oakWoodType specificGravity="142.2" /> </oak> <maple>
   <mapleWoodType specificGravity="3.4"/> </maple> <walnut>
   <walnutWood specificGravity="123.4" /> </walnut>

At this point, my binding.xml file looks like this:

<mapping class="com.ge.Tree"
    abstract="true"
    marshaller="com.ge.CustomTreeMarshaller">
       <structure />
</mapping>

But it doesn't work.

Do you folks have any ideas or pointers?

Thanks!
Ian

------------------------------------------------------------------------
-
Take Surveys. Earn Cash. Influence the Future of IT Join
SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
V
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to