wood burning stoves
The moose likes XML and Related Technologies and the fly likes jaxb - xmladapter for rootElement? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "jaxb - xmladapter for rootElement?" Watch "jaxb - xmladapter for rootElement?" New topic

jaxb - xmladapter for rootElement?

dan volfman

Joined: Jan 15, 2010
Posts: 6
i need something that will act like an xmlAdapter, but will be defined on a xmlRootElement (rather than on a field).

the purpose is custom marshalling and unmarshalling of fields which will be determined by the fields values.
for example, if a field value is of a particular syntax, then the field will be changed while unmarshalling .

i have a lot of objects that are serialized to xml files, and a lot of fields that potentially could be changed, and thats why i'm looking for a solution at the rootElement level and not at the field level.

any suggestions?

Blaise Doughan

Joined: Aug 25, 2010
Posts: 8
You can specify the @XmlJavaTypeAdapter annotation at the class level. This means that that any property of this particular class will automatically use the adapter. Unfortumately the adapter does not get activated when this object is the root object of the tree. In this case you need to call the adapter yourself.
I agree. Here's the link: http://aspose.com/file-tools
subject: jaxb - xmladapter for rootElement?
It's not a secret anymore!