I've always thought this was a bit unclear in jibx - here's the binding
you're looking for:

<binding direction="input">
  <mapping name="Response" class="X">
    <collection name="Successes" field="successes"
type="java.util.ArrayList">
      <value name="Pos" type="java.lang.String" />
    </collection>
  </mapping>
</binding>

Note that the 'type="java.lang.String"' wasn't necessary in jibx prior
to 1.0, but now appears to be required (even if you're declaring your
lists using generics).  In the pre-1.0 (the beta versions), you would do
this:

      <value style="element" name="Pos" />

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Monday, July 31, 2006 2:15 AM
To: jibx-users@lists.sourceforge.net
Subject: [jibx-users] Mapping to collection of Strings

Hi,

I have the following XML:

<Response>
   <Successes>
     <Pos>00000001</Pos>
     <Pos>00000002</Pos>
     etc.
   </Successes>
</Response>

that I want to map to field successes in class:

public class X {

   public List<String> successes;

}

but I cannot define a working binding for this.

I find it easy to map collection of classes, but struggle with mapping  
of simple elements.

Could someone help?

Best regards,

J-F



------------------------------------------------------------------------
-
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=DEVDE
V
_______________________________________________
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