users@jaxb.java.net

HashMap and JAXB

From: Peter Dolukhanov <peter.dolukhanov_at_ncl.ac.uk>
Date: Tue, 28 Jan 2003 19:00:36 +0000

Hello,



I current have an application whereby I need to manually serialize and
deserialize Java Objects -> XML. I would love to use JAXB to accomplish
this, however, as far as I can tell there is no support for the HashMap
object. From what I have derived from previous discussions this is due
to HashMaps having no inherent order.



Has anyone come up with a solution that could achieve mapping a HashMap
to XML?



The format of my XML would be



<attribute name="name"><value>xxx</value></attribute>



and in Java it would obviously be a HashMap, whereby I have done
HashMap.put("name","value"). There will be different objects stored in
the HashMap, i.e. Booleans, ints, String etc.



Can anyone shed any light onto this matter?



Best Regards,

Peter Dolukhanov