> <node id="0">
>   <node id="1">
>     <node id="1-1">
>       <node id="1-1-1">
>         <node id="1-1-1-1" />
>       </node>
>     </node>
>     <node id="1-2" />
>     <node id="1-3" />
>   </node>
> </node>
> 
> public class Node {
>     List subNodes = new ArrayList();
>     String id;
> }
> 
> So how do I write the binding.xml?
> 
> Have a feeling this is very easy though, thanks for your times.

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

Reply via email to