File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes JAXB with legacy beans?  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Storm Applied this week in the Other Open Source APIs forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "JAXB with legacy beans?  " Watch "JAXB with legacy beans?  " New topic

JAXB with legacy beans?

Brian Mulholland
Ranch Hand

Joined: Mar 12, 2009
Posts: 61
Let's say I have a bean structure not generated from an XSD by JAXB, but which is FAIRLY close to the XML structure. Is there some annotation way I can direct JAXB how to unmarshal from XML to a library of legacy beans by using annotations?

A little more detail. Let's say I have an XML document that looks like:

I want to bind it to an object that has a List<String> as a property. I can add annotations easily, but don't want to unwind the code that references the java object, and the XML is being produced by a third party. I am daydreaming of an annotation that allows me to tell JAXB that it should dump the text node from each listitem node into the List<String>. I have a variety of similar things, but am hoping that once I see how one is done, i can extrapolate to other situations.
subject: JAXB with legacy beans?