users@jaxb.java.net

Re: Custom mapping for Maps in JAXB

From: Leo Romanoff <romixlev_at_yahoo.com>
Date: Fri, 18 Jun 2010 10:43:16 -0700 (PDT)

Hi Wolfgang,

> Say, you have a class Cabinet, where your Map should ultimately be a
> field.
> For unmarshalling arbitrary content, you'll need another field
> Object any
>as the root of your arbitrary <k>v</k> stuff. (I'm not seriously
considering
>of using the Object any to store the Map, too.) You can do the conversions
>after the document has been unmarshalled. If you are worried about the
effort
>for walking the final tree, you might look into
>javax.xml.bind.Unmarshaller.Listener, method afterUnmarshal, and do it in
>the callback.

OK. I understand now how to unmarshall.

But what about marshalling?
Should I somehow produce a DOM tree for my map, so that it is used for the
xsd:any element? Should I store this DOM tree into the "Object any" element?
When and how should I do it? May be there is something like a special
listener or beforeUnmarshal callback?

Thanks again,
   Leo

-- 
View this message in context: http://old.nabble.com/Custom-mapping-for-Maps-in-JAXB-tp28779221p28928881.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.