4
任何人都可以告訴我如何用XStream序列化HashMap?XStream with HashMap <String,String>
private HashMap<String,String> attributes;
attributes = new HashMap<String,String>();
attributes.put("Description","Value");
attributes.put("Description2","Value2");
attributes.put("Description3","Value3");
我的XML看起來像
<attributes>
<entry>
<string>Description</string>
<string>value</string>
</entry>
<entry>
<string>Description2</string>
<string>Value2</string>
</entry>
<entry>
<string>Description3</string>
<string>Value3</string>
</entry>
</attributes>
我要像
<attributes>
<attr>
<description>Description</description>
<value>Value</value>
</attr>
<attr>
<description>Description2</description>
<value>Value2</value>
</attr>
<attr>
<description>Description3</description>
<value>Value</value>
</attr>
</attributes>
的輸出如何能實現,使用XStream的?註釋可能嗎?