You should be able to just use a custom marshaller/unmarshaller for the Map itself. That won't use your get/set methods for the individual items, but I don't see any reason why you'd want to.

The custom marshaller/unmarshaller documented at http://jibx.sourceforge.net/tutorial/binding-custom.html#marunmar handles String keys with arbitrary object values (which must have their own <mapping> definitions). Changing this sample code (included in the /build/extras tree) to work with String values is simple. It sounds like that will give you exactly what you need.

- Dennis

Norm Deane wrote:

Is there any way to take this structure...

  <ItemDetail>
     <!-- some other elements here -->

     <Extrinsic name="ExtName1">Ext text 1</Extrinsic>
     <Extrinsic name="ExtName2">Ext text 2</Extrinsic>
     <Extrinsic name="ExtName3">Ext text 3</Extrinsic>
  </ItemDetail>

and map it into a structure like this...

  public class ItemDetail
  {
     // properties for other elements in ItemDetail
     private Map extrinsics = new HashMap();

public void setExtrinsics(String key, String value) {
extrinsics.put(key,value); }
public String getExtrinsics(String key) { (String)extrinsics.get(key);
} }


It seems that this could be done with <collection> if it supported maps but
it doesn't.  Writing a custom Marshaler/UnMarshaller isn't really an option
because the ItemDetail element contains many other nested elements that I
don't want to have to deal with.

--Norm





------------------------------------------------------- This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months! http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click _______________________________________________ jibx-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to