Tutorial :How to serialize a Map using Simple XML?



Question:

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.


Solution:1

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?


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »