简体   繁体   中英

jaxb marshall complex structure

I have a structure like this:

 Hashtable<String, ArrayList<Hashtable<Integer, Integer>>> complexTable

And I want to marshall this using JAXB. I suppose I should write an Adapter for this, but I have no idea how this adapter should look like. Can anybody help me with this?

I'm not clear what you're trying to do. Do you have a schema for the above object ? Have you looked at the JAXB unofficial guide, particularly the marshalling section ?

If you don't have a schema, and you simply need to persist the above as XML, do you want/need to use JAXB ? Instead you may be interested in XStream . It will serialise/deserialise POJOs (plain old Java objects) to/from XML without the need for a schema. It will handle the above case trivially.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM