我的XML结构如下
<PaymentData>
<reserveData>
<reserveDto>
<pNumber>
</reserveDto>
</reserveData>
</PaymentData>
和我的班级结构如下
Class PaymentData
Private ReserveData reserveData
Class ReserveData (Xtream alias “reserveData”)
Private ReserveDto lReserveDto[];
Class ReserveDto (Xtream alias “reserveDto”)
Private String pNumber
当我有上述结构时,Xtream.fromXML()不会为ReserveData生成值。
我知道有一个替代解决方案,使用Xstream Implicit和ArrayList,如下所示
Class PaymentData
Private ReserveData reserveData
Class ReserveData
@XStreamImplicit
ArrayList<ReserveDto> reserveDto
Class ReserveDto
Private String pNumber
但是我们不想更改为ArrayList,因为客户端只能使用数组。 如果有人有解决方案,请告诉我。