I am using Kotlin 0.491 and Simple XML 2.6.7 library (for xml processing)
This will return at runtime: ERROR/dalvikvm(1557): Unable to resolve Lcom/silverkeytech/android_rivers/outlines/Opml; annotation class 1207
package com.silverkeytech.android_rivers.outlines
import org.simpleframework.xml.Attribute
import org.simpleframework.xml.Element
import org.simpleframework.xml.Root
[Root(strict=false)]
public data class Opml() {
[Element] public var head: Head? = null
[Attribute] public var version: String? = null
}
package com.silverkeytech.android_rivers.outlines
import org.simpleframework.xml.Element
public data class Head() {
[Element] public var title: String? = null
[Element] public var dateCreated: String? = null
[Element] public var dateModified: String? = null
[Element] public var ownerName: String? = null
}
Kotlin function that makes the deserialization
fun transformFromXml(xml : String?){
var serial : Serializer = Persister()
try{
val opml : Opml? = serial.read(javaClass<Opml>(),xml)
Log.d(TAG, “OPML ${opml?.head?.title}”)
}
catch (e: Exception){
Log.d(TAG, “Exception ${e.getMessage()}”)
}
}
However if you remove the data keyword, it works just fine.