如何序列化Map< String,String>使用Simple XML? [英] How to serialize a Map<String, String> using Simple XML?

查看:126
本文介绍了如何序列化Map< String,String>使用Simple XML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用简单XML 对地图进行序列化,使其看起来像:

How would you go about serialising a Map using simple XML so that it looks something like:

<elem foo="value">key</elem>

而不是正常

<elem foo="key">value</elem>

(地图是一对多,因为这将由人类编辑,我希望它更清楚。)

(The map is one to many, and since this will be edited by humans, I wanted it to be clearer.)

不修复。

推荐答案

你尝试过类似的事情:

@ElementMap(entry="property", value="value", attribute=true, inline=true)
private Map<String, String> map;

或某种组合,即使用 @ ElementMap注释呢?

or some combination, i.e. to use the other attributes of the @ElementMap annotation too?

这篇关于如何序列化Map&lt; String,String&gt;使用Simple XML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆