I would like to marshal a Map<String, MyClass> into a List<MyClass>. In this example, Property.java is a custom class that I have defined.



public class Root {
private Map<String, Property> properties = new HashMap<String, Property>();
}


I know how to get to this point:



<?xml version="1.0" encoding="UTF-8"?>
<root>
<properties>
<property name="A">a</property>
<property name="B">b</property>
</properties>
</root>


This solution is described in Blaise Doughan's answer: http://ift.tt/1ofOL5D But this is not quite what I need. This is what I need to get after marshalling (notice the <properties> wrapper tag missing):



<?xml version="1.0" encoding="UTF-8"?>
<root>
<property name="A">a</property>
<property name="B">b</property>
</root>


I did my research and I realize that my use case is a more specific version of a general problem described in these threads:



Any help is greatly appreciated!


No comments:

Post a Comment