Thanks Dennis,

I changed the binding to

<collection field="street" item-type="java.lang.String"
type="java.util.ArrayList" >
   <value name="Street" />
</collection>

and that worked great.  Thanks for the tip on post-set method.

Ray
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dennis Sosnoski
Sent: Friday, March 17, 2006 5:13 AM
To: [email protected]
Subject: Re: [jibx-users] collection with required content?

Hi Raymond,

There's no way to directly specify that a collection has to have at 
least one item present (or any other number of items, for that matter). 
The best you can do is add a post-set method to the containing object 
which can verify that the items you expected were indeed found.

Your ClassCastException appears to be an unrelated issue. That 
<collection> binding is probably the cause - what the <collection> 
binding says is that the contents of the ArrayList will all be String 
objects, but because you don't have any child content for the 
<collection> it expects to find a <mapping> definition for these 
objects. You probably want to use a <value> element inside the 
collection to give an element name as a wrapper around the String values.

Sorry, Orjan, I guess I overlooked your original email on the required 
content topic.

  - Dennis

Raymond N. Ritz wrote:

>I am interested in this as well, as I ma having some trouble binding an
>ArrayList of Strings using the <collection> element such that the element
is
>defined as element+ in the dtd.
>
><collection name="Street" item-type="java.lang.String" field="street"
>type="java.util.ArrayList" />
>
>I keep receiving a java.lang.ClassCastException when attempting to marshall
>the ArrayList to this collection.
>
>A trace on the ArrayList prior to handing it off to jibx shows that I have
>only objects of type java.lang.String in the list.
>
>Any thoughts are appreciated.
>
>Ray
>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] On Behalf Of Orjan Austvold
>Sent: Tuesday, February 28, 2006 10:37 AM
>To: [email protected]
>Subject: [jibx-users] collection with required content?
>
>Hi,
>
>Is there a way to specify a binding for a collection which requires at 
>least one element? In DTD terms this would be noted by a '+' sign after 
>the element instead of a '*' sign.
>
>
>Thanks,
>Ørjan
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by xPML, a groundbreaking scripting language
>that extends applications into web and mobile media. Attend the live
webcast
>and join the prime developer group breaking into this new coding territory!
>http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642
>_______________________________________________
>jibx-users mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by xPML, a groundbreaking scripting language
>that extends applications into web and mobile media. Attend the live
webcast
>and join the prime developer group breaking into this new coding territory!
>http://sel.as-us.falkag.net/sel?cmd________________________________________
_______
>jibx-users mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>  
>


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to