Ktor xml to data class workflow?

I have a Ktor application setup that is needing to accept a new POST text/xml request, the application is accepting the content type correctly but I am having difficulty in creating a valid data class that the xml can be parsed into.

How do I generate a valid kotlin data class for a xml body like this:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <sdmi:CreateShape soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:oldthing="http://www.wwwdotcom.com/schema/docco/v2/gone">
                <description>Shape 123</description>

io.ktor:ktor-serialization-kotlinx-xml seems to use nl.adaptivity.xmlutil.serialization under the covers, but there are also no documented steps that I can find to generate a valid data class or on to how annotate and write one manually.

Does anyone have any tips on how to do this?

I mean XML and JSON are basically the same thing. Or maybe not, but I think of them as the same thing. :stuck_out_tongue: Create an object that mimics the structure of your XML.

So in this case, it’d be something like this:

data class Envelope(val body: Body)

data class Body(val createShape: CreateShape, val encodingStyle: String) // idk if you need the encoding style, or if that's something the XML uses

data class CreateShape(val jobType: JobType)

data class JobType(
    val description: String,
    val name: String,
    val rDryer: Int,
    val machine: Int

I haven’t actually used XML. :stuck_out_tongue: But I’m 90% sure that code I just posted will work.