[英]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. 我想使用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 ? 您是否看过JAXB非官方指南,特别是编组部分 ?
If you don't have a schema, and you simply need to persist the above as XML, do you want/need to use JAXB ? 如果您没有模式,而只需要将以上内容作为XML持久保存,是否/需要使用JAXB? Instead you may be interested in XStream . 相反,您可能对XStream感兴趣。 It will serialise/deserialise POJOs (plain old Java objects) to/from XML without the need for a schema. 它将不需要模式就将POJO(普通的旧Java对象)与XML序列化/反序列化。 It will handle the above case trivially. 它将轻松处理上述情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.