简体   繁体   English

jaxb marshall复杂结构

[英]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.

相关问题 JAXB Marshall &amp; Unmarshall Java 复杂类 - JAXB Marshall & Unmarshall Java complex Class 如何用jaxb编组? - How to marshall a set with jaxb? JAXB Marshall不输出XML - JAXB Marshall not output XML JAXB不像预期的那样马歇尔 - JAXB Does not Marshall as Expected JAXB Hashmap的Marshall数组 - JAXB Marshall Array of Hashmap 使用JAXB Marshall null值 - Marshall null values with JAXB JAXB-Marshall / Unmarshall问题 - JAXB - Marshall/Unmarshall issues 循环jaxb马歇尔 - loop a jaxb marshall 如何在JAXB中将XML与名称空间编组? - How to marshall XML with namespace in JAXB? 如何编组 ArrayList<object> [] 在 JAXB 中?<div id="text_translate"><p> 我有一个 ArrayList[] 类型的变量(列表),我想将它保存在 XML 中。 我尝试了 JAXB,但它只保存了“”字符串(“的重复”等于 list.length)并且在 ArrayLists 中没有任何项目。如果我尝试二维数组,它工作正常。如果我尝试 ArrayList,它也可以正常工作。我怎么解决这个问题?</p><p> 我的代码类似于:</p><pre> @XmlRootElement public class SomeClass { @XmlElement(name="part") private final ArrayList&lt;Object&gt;[] list; ... constructor, which fills the list variable }</pre><p> 有人可以告诉我该怎么做吗? 请。<br><br></p></div></object> - How to marshall ArrayList<Object>[] in JAXB?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM