Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to serialize a Map<String, String> using Simple XML?

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

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

Instead of the normal

<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.)

[EDIT]: Doesn't Fix.

like image 228
brice Avatar asked Jul 28 '10 13:07

brice


1 Answers

Have you tried something like:

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

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

like image 129
A. Ionescu Avatar answered Oct 17 '22 20:10

A. Ionescu