Sorry, I mis-represented the problem. All of the Tree classes have a
Wood field and there are no inherited class types:
class Oak implements com.ge.Tree {
private Wood woodType = new Wood();
} class Maple implements
com.ge.Tree {
private Wood woodType = new Wood();
} class Walnut implements
com.ge.Tree {
private Wood woodType = new Wood();
}
The output XML needs to conform to a schema that says some of Trees have
different element names for their "woodType" field (thus the elements
below the tree names in my XML output example).
Thanks,
Ian
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dan
Cooperstock
Sent: Wednesday, December 13, 2006 1:39 PM
To: JiBX users
Subject: Re: [jibx-users] Dynamic Element Name?
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: [email protected]
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
[email protected]
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=DEVDE
V
_______________________________________________
jibx-users mailing list
[email protected]
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users