Hi Luciano,

Do you really need to make the ChildCPR element names different, 
embedding the index position as part of the name? If not, you should be 
able to just use a nested <collection> within the ExtendedApplicationVO 
binding, something along these lines:

  <collection name="ChildrenInfo" field=childrenCpr">
    <value name="ChildCPR" field="cpr"/>
  </collection>

If you really do need to make the element names different you'd need a 
custom marshaller/unmarshaller for this purpose. You could use the 
org.jibx.extras.TypedArrayMapper code as a base for this, but rather 
than calling marshal/unmarshal for each instance you'd just deal 
directly with the XML.

Ask if you need more details.

  - Dennis

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



koevet wrote:
> Hello,
> I recently started using Jibx and I found it fantastic.
> I have an issue with a mapping and I would like to ask some advice.
>
> XML
> ======
> <SomeNode>
> <Name>Luciano</Name>
> <Address>Borgergade, 26</Address>
> <City>Copenhagen</City>
> <ChildrenInfo>
> <Child1CPR>13893189</Child1CPR>
> <Child2CPR>13493189</Child2CPR>
> <Child3CPR>17493949</Child2CPR>
> </ChildrenInfo>
> </SomeNode>
>
> Java Class
> ======
> public class ExtendedApplicationVO {
>
> private String name;
> private String address;
> private String city;
> private CPR[] childrenCpr;
>
> // ... getters and setters ...
>
>
> }
>
> public class CPR {
> private String cpr;
> public CPR(String cpr) throws ParseException {
> this.cpr = cpr;
> }
> // NO SETTERS!!!
> }
>
>
> I don't basically know how to map the ChildrenInfo collection of CPR. I have
> tried both using a custom marshaller/unmarshaller and the TypedArrayMapper
> with no success.
>
> Any tips?
>
> Thanks
> Luciano
> --
> View this message in context: 
> http://www.nabble.com/-Newbie--Help-with-binding-t1848505.html#a5045703
> Sent from the jibx-users forum at Nabble.com.
>
>
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> jibx-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>   

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to