That's a tricky case, Bret. As you've found, the custom unmarshaller 
handling expects to be coupled to a particular object. Since you want to 
take the collection of items from the XML and split it into three 
separate collections (sorted by type) in the object, you can't just use 
an unmarshaller for the collection itself.

I guess the other alternative would be to use a custom unmarshaller for 
the actual <OBJ> element, with that unmarshaller returning the 
appropriate type of object. Then you could use an add-method on the 
parent object, which could check the type of object being added and put 
it on the appropriate list. That's definitely getting into some messy 
handling, though.

- Dennis

Dennis M. Sosnoski
SOA and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117



Bret Gregory wrote:
>
> I should probably also note that the different objects map to 
> different classes as the attributes/Children elements that they may 
> hold are different.
>
> So element ABC would map to a Class of Type ABC. So if isn’t as 
> straight forward as my simplified example.
>
> Thanks for the help.
>
> ------------------------------------------------------------------------
>
> *From:* [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] *On Behalf Of *Bret 
> Gregory
> *Sent:* Thursday, April 19, 2007 11:00 AM
> *To:* jibx-users@lists.sourceforge.net
> *Subject:* [jibx-users] Custom Unmarshaller
>
> I am running into an issue where I am trying to map an element and its 
> children into several Lists on the parent object
>
> Using a Custom Unmarshaller.
>
> The parent object would have 3 lists:
>
> List _abc
>
> List _def
>
> List _xyz
>
> I have something like this:
>
> <ParentObj>
>
> <OtherElements>…</OtherElements>
>
> <OBJs>
>
> <OBJ id=”1” name=”an object abc”>
>
> <ABC value=”testABC” date”04-05-2007”/>
>
> </OBJ>
>
> <OBJ id=”2” name=”an object def”>
>
> <DEF value=”testDEF” date=”04-05-2007”/>
>
> </OBJ>
>
> <OBJ id=”3” name=”an object xyz”>
>
> <XYZ value=”testDEF” date=”04-05-2007”/>
>
> </OBJ>
>
> <OBJ id=”4” name=”an object def2”>
>
> <DEF value=”testDEF2” date=”04-05-2007”/>
>
> </OBJ>
>
> </OBJs>
>
> </ParentObj>
>
> I wrote a custom unmarshaller to handle the creation of the various 
> object instances.
>
> But when I try to call to it in my structure:
>
> <structure name=”OBJs” marshaller=”ObjMarshaller” 
> unmarshaller=”ObjUnmarshaller”/>
>
> I get the error:
>
> Warning: No object for structure; marshaller attribute ignored;
>
> I was sorta hoping that the Object for the structure would be the 
> parent object.
>
> Is there a way to do this or at least get a similar result? Is there a 
> way to pass in a
>
> Reference to the current object instead of pointing the structure to a 
> contained reference?
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> ------------------------------------------------------------------------
>
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>   

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to