Hi Brian,

Thanks for helping out on the users list!

Just as an improvement to your recommendation, though, since about 1.1 
JiBX has supported a create-type="..." attribute for <collection> 
elements (along with <mapping> and <structure>, for that matter). This 
allows you to avoid the nuisance of factories when dealing with abstract 
classes or interfaces.

Cheers,

  - 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



Brian Wallis wrote:
> ...
>
> Not too hard :-)
>
> <binding>
>   <mapping class="Node" name="node">
>     <collection factory="org.jibx.runtime.Utility.arrayListFactory"
>       field="subNodes" item-type="Node"/>
>     <value field="id" name="id" style="attribute"/>
>   </mapping>
> </binding>
>
> Should do the job in both directions. You will need the factory method on
> the collection for marshalling since you use the "List" type but if the
> subNode type is a concrete class (such as ArrayList) then you don't need
> the factory. All this is doing is recursively applying the Node mapping
> for each element in the subNodes list
>
>
> Brian Wallis
> Senior Consultant
> Object Consulting 
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> ------------------------------------------------------------------------
>
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>   

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to