[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jibx-users
Subject:    RE: [jibx-users] collection with required content?
From:       "Raymond N. Ritz" <ray () ritzware ! com>
Date:       2006-03-17 15:35:29
Message-ID: 006a01c649d8$6c704b20$0c00a8c0 () FatTire
[Download RAW message or body]

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: jibx-users-admin@lists.sourceforge.net
[mailto:jibx-users-admin@lists.sourceforge.net] On Behalf Of Dennis Sosnoski
Sent: Friday, March 17, 2006 5:13 AM
To: jibx-users@lists.sourceforge.net
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: jibx-users-admin@lists.sourceforge.net
>[mailto:jibx-users-admin@lists.sourceforge.net] On Behalf Of Orjan Austvold
>Sent: Tuesday, February 28, 2006 10:37 AM
>To: jibx-users@lists.sourceforge.net
>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
>jibx-users@lists.sourceforge.net
>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
>jibx-users@lists.sourceforge.net
>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
jibx-users@lists.sourceforge.net
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
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic