I have xml like this:
<horo>
<aries>
<today>
Сегодня вас могут здорово огорчить. Если от расстройства все начнет валится из рук, просто спокойно сядьте и тихонько подождите хорошей новости.
</today>
</aries>
<taurus>
<today>
Сегодня у вас могут возникнуть проблемы на личном фронте. Спасти вас от перспективы оказаться не у дел может сухой, рациональный и в высшей степени объективный подход к проблеме.
</today>
</taurus>
</horo>
And now i learning kotlin whith retrofit. I include libraries for parse xml, and not i cant understand how create object for parsing this xml. I have object:
@Root(name = "horo", strict = false)
open class DailyHoroscope{
@get : Element(name = "aries") var aries : Aries? = null
}
@Root(name = "aries", strict = false)
open class Aries{
@get : Element(name = "today") var today : String? = null
}
but i have error:
rg.simpleframework.xml.core.ConstructorException: Default constructor can not accept read only @org.simpleframework.xml.Element(data=false, name=aries, required=true, type=void) on method 'aries' in class ac.kotlintest.model.
upd
i writed code in java:
@Root(name = "horo", strict = false)
public class DailyHoroscopeJ {
@Element(name = "aries")
public Aries aries;
public Aries getAries() {
return aries;
}
public void setAries(Aries aries) {
this.aries = aries;
}
}
@Root(name = "aries", strict = false)
class Aries{
@Element(name = "today")
public String today;
public String getToday() {
return today;
}
public void setToday(String today) {
this.today = today;
}
}
and it work fine, then i convert to kotlin
@Root(name = "horo", strict = false)
class DailyHoroscope {
@get:Element(name = "aries")
var aries:Aries? = null
}
@Root(name = "aries", strict = false) class Aries {
@get:Element(name = "today")
var today:String? = null
}
but i have same problem((((