``` import com.fasterxml.jackson.dataformat.xml.Xm...
# announcements
j
Copy code
import com.fasterxml.jackson.dataformat.xml.XmlMapper
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty
import com.fasterxml.jackson.module.kotlin.KotlinModule
import com.fasterxml.jackson.module.kotlin.readValue

data class MyThing(
        @JacksonXmlProperty(isAttribute = true)
        val name: String,
        @JacksonXmlProperty(isAttribute = true, localName = "years")
        val age: Int
)

fun main(args: Array<String>) {
    val mapper = XmlMapper().registerModule(KotlinModule())
    val xml = """<MyThing name="Test" years="10" />"""
    val thing: MyThing = mapper.readValue(xml)
    println(thing)
}