I'm traying to parse XML with Retrofit2 and SimpleXmlConverterFactory, that's working until I tried to read attributes of a node, there, it crashes with no log.
My XML :
<HotelSearchRES>
<Destination id="1">Tunisie</Destination>
<City id="104">Hammamet</City>
<Currency>1</Currency>
<Language>1</Language>
<FromDate>01/12/2021</FromDate>
<ToDate>02/12/2021</ToDate>
</HotelSearchRES>
My Classes :
@Root(name = "HotelSearchRES", strict = false)
class SearchResultsWrapper @JvmOverloads constructor() {
@Element(name = "Destination")
var destination: Destination? = null
@set:Element(name = "City")
@get:Element(name = "City")
var city: String? = null
@set: Element(name = "Currency")
@get: Element(name = "Currency")
var currency: Int? = null
@set: Element(name = "Language")
@get: Element(name = "Language")
var language: Int? = null
@set: Element(name = "FromDate")
@get: Element(name = "FromDate")
var fromDate: String? = null
@set: Element(name = "ToDate")
@get: Element(name = "ToDate")
var toDate: String? = null
}
class Destination(){
@Attribute(required = false)
val id: String? = null
@Text(required = false)
val destination: String? = null
}
The problem seams related to attribute reading, so if I remove the first line everything works :
@Element(name = "Destination")
var destination: Destination? = null
Any help would be appreciated ;)