0

I have XML structure as below

<PaymentData>
  <reserveData>
     <reserveDto>
        <pNumber>
     </reserveDto>
  </reserveData>
</PaymentData>

and My class structure is as below

Class PaymentData                                             
   Private ReserveData reserveData                    
Class ReserveData (Xtream alias “reserveData”)        
  Private ReserveDto lReserveDto[];                   
Class ReserveDto  (Xtream alias “reserveDto”)
  Private String pNumber

When I have above structure and Xtream.fromXML() doesn't generate values to the ReserveData.

I know there is alternative solution by using Xstream Implicit and ArrayList as below

Class PaymentData                                             
   Private ReserveData reserveData                    
Class ReserveData      
  @XStreamImplicit
  ArrayList<ReserveDto> reserveDto                  
Class ReserveDto 
  Private String pNumber

But we don't want to change to ArrayList as client has limitation to use only array. Please let me know if any one has solution for this.

Nat Ritmeyer
  • 5,634
  • 8
  • 45
  • 58

1 Answers1

1

The XStream Annotations Tutorial suggests that you can use @XStreamImplicit on arrays (and maps) as well as lists.

facundofarias
  • 2,973
  • 28
  • 27
Ian Roberts
  • 120,891
  • 16
  • 170
  • 183
  • Thanks. We were using Xstream version jar 1.2 which doesn't support @XStreamImplicit on arrays,After upgrading to 1.3.4 jar , issue is resolved – user1682888 Sep 21 '12 at 13:35
  • If the answer solved your problem, please consider _accepting_ it by clicking the green tick mark to the left. People will be more willing to answer your future questions if they know you are likely to accept good answers. – Ian Roberts Sep 21 '12 at 13:58