You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Marcos Truchado Martín <ma...@hp.com> on 2006/03/23 12:21:31 UTC

betwixt and mixed collections

Hi all, I�m having a problem trying to parse mixed collections. This is 
what I obtaint if I parse my bean to a XML file:

<?xml version='1.0' encoding="ISO-8859-1"?>
  <container>
    <element>
      <atr1>atr1</atr1>
      <atr2>atr2</atr2>
    </element>
    <element>
      <atr21>atr21</atr21>
      <otherelement>otherelemt1</otherelement>
      <otherelement>otherelemt2</otherelement>
      <otherelement>otherelemt3</otherelement>
      <otherelement>otherelemt4</otherelement>
    </element>
  </container>

This is correct and it�s the result I�m expecting. The problem comes 
when I try to parse this XML into a bean. Betwixt seems not to recognice 
the type of the elements under the Vector and it create instances of 
Object instead the right ones. If I parse the above XML into a bean and 
then into a XML again I obtaint:

<?xml version='1.0' encoding="ISO-8859-1"?>
  <container>
    <element/>
    <element/>
  </container>

Every element is parsed as Object. The source code I�m using (including 
the dot betwixt files) is attached to this mail.

Note that if I turn on MapIDs property under the binding configuration 
the result is correct but I get some id="number" attributes that must 
not be there for my needs.

Thanks in advance.

Re: betwixt and mixed collections

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
hi anil

this isn't about betwixt: you're more likely to get a good answer
quickly if you follow the list netiquette
(http://wiki.apache.org/jakarta-commons/JakartaCommonsEtiquette)

On Wed, 2006-03-29 at 10:29 +0530, Anil Mathew wrote:
> hai
> i am working on jelly unit but not able to find enough resources from net
> can any body help me out ????????
> i have allready gone through jakarta and onjava site but not able to find
> enough
> sample to work out
> please help me out??????????????
> is jellyunit  or junit  is better !!!!!!!!!!!!!!!!!!

the best answer to this is: they are different.

jelly is a xml based scripting language. jellyunit allows unit tests to
be creating using jelly scripting. this can be useful for bulk testing.
 
junit is the library that started the unit testing revolution. it uses
reflection.

- robert


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: betwixt and mixed collections

Posted by Anil Mathew <de...@gmail.com>.
hai
i am working on jelly unit but not able to find enough resources from net
can any body help me out ????????
i have allready gone through jakarta and onjava site but not able to find
enough
sample to work out
please help me out??????????????
is jellyunit  or junit  is better !!!!!!!!!!!!!!!!!!
thanks in advance
anil mathew



On 3/28/06, Marcos Truchado Martín <ma...@hp.com> wrote:
>
> Hi Robert:
>
> Thanks a lot for your help. I have tried to run the code with both alpha
> 1.0 and latest nightly (marked as 0.8-dev 20060327), and I obtaint the
> same wrong result I was receiving with 0.7
>
> Regards.
>
> robert burrell donkin escribió:
> > On Thu, 2006-03-23 at 12:21 +0100, Marcos Truchado Martín wrote:
> >
> >> Hi all, I´m having a problem trying to parse mixed collections.
> >>
> >
> > hi marcos
> >
> > are you using the latest code? if not please checkout and build or use a
> > recent nightly and then retest.
> >
> > - robert
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> >
>
>
>

Re: betwixt and mixed collections

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On Tue, 2006-03-28 at 10:04 +0200, Marcos Truchado Martín wrote: 
> Hi Robert:

hi marcos

> Thanks a lot for your help. I have tried to run the code with both alpha 
> 1.0 and latest nightly (marked as 0.8-dev 20060327), and I obtaint the 
> same wrong result I was receiving with 0.7

container#addElement accepts objects of type Object. Betwixt needs to
know the candidate classes which may be included in that collection.  

you need to use a polymorphic mapping. read
http://jakarta.apache.org/commons/betwixt/guide/reading.html#Reading%
20Polymorphic%20Mappings. 

i haven't managed to track down the exact mapping you need but i'll try
to do that at the weekend.

- robert



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: betwixt and mixed collections

Posted by Marcos Truchado Martín <ma...@hp.com>.
Hi Robert:

Thanks a lot for your help. I have tried to run the code with both alpha 
1.0 and latest nightly (marked as 0.8-dev 20060327), and I obtaint the 
same wrong result I was receiving with 0.7

Regards.

robert burrell donkin escribió:
> On Thu, 2006-03-23 at 12:21 +0100, Marcos Truchado Martín wrote:
>   
>> Hi all, I´m having a problem trying to parse mixed collections. 
>>     
>
> hi marcos
>
> are you using the latest code? if not please checkout and build or use a
> recent nightly and then retest.
>
> - robert
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>   


Re: betwixt and mixed collections

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On Thu, 2006-03-23 at 12:21 +0100, Marcos Truchado Martín wrote:
> Hi all, I´m having a problem trying to parse mixed collections. 

hi marcos

are you using the latest code? if not please checkout and build or use a
recent nightly and then retest.

- robert


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org