commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Portabella Clotet <>
Subject Use the mapping file to specify how to serialize a hashmap into a XML
Date Mon, 07 Sep 2009 11:19:58 GMT

We use Apache Betwixt to serialize a Java object into XML using a mapping

Betwixt can also serialize HashMaps, but it uses a predefined entry
key/value schema.

For instance, for
HashMap person = new HashMap();
person.put("name", "John");
person.put("bibliography", "John started his...");

it will produce:
  <value>John started his...</value>

Is it possible to use the same mapping file to specify how the hashmap
should be serialized?
For instance, using this schema,
<?xml version="1.0" encoding="UTF-8" ?>
<info primitiveTypes="attribute">
  <element name='person'>
    <attribute name='name' property='name'/>
    <element name='bibliography' property='bibliography'/>

Betwixt would serialize the previous hashmap as:
<person name="John">
  <bibliography>John started his...</bibilography>

Is that possible? how?
or, do you plan to implement such a feature?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message