It took a while but I figured out what was wrong. This looks like a bug in
Betwixt.
In the generated XML below, the <entry> element contains tags <Key> and
<Value> (note the capitalization). When reading back, Betwixt appears to be
looking instead for <key> and <value> (no capitalization). If I pass the
generated XML through a filter to locate and replace the capitalized tags
with the uncapitalized ones before reading back into Betwixt, it works -
the map is populated correctly.
I'll check the open bugs to see if this is known about and report it if
not.
[EMAIL PROTECTED] wrote on 08/27/2008 01:07:13 PM:
>
> I have a bean containing a Map<String, String> and the get/set/add
methods:
>
> private Map<String, String> details = new TreeMap<String, String>();
>
> public Map<String, String> getDetails()
> {
> return details;
> }
>
> public void setDetails(Map<String, String> details)
> {
> this.details = details;
> }
>
> public void addDetail(String key, String value)
> {
> details.put(key, value);
> }
>
> When I use betwixt to render the bean as XML the output looks fine:
>
> <Details>
> <entry>
> <Key>...</Key>
> <Value>...</Value>
> </entry>
> </Details>
>
> The problem is that when the bean is reconstructed from the XML, the Map
is
> empty. I put a breakpoint in the addDetail() method and it isn't getting
> hit, so this method isn't being called. Is this an error in the
> documentation or is there something else I've missed?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]