Does the output use kotlinx-serialization-xml or JAXB?
The default output uses kotlinx-serialization-xml via the XmlUtil library (nl.adaptivity.xmlutil:xmlutil-serialization). It pairs @Serializable data classes with @XmlSerialName, @XmlElement(false) for attributes, and @XmlValue for text content. JAXB is JVM-only and does not work on Kotlin Multiplatform — XmlUtil works on JVM, JS, and native targets.
Can the same data class also be used with JAXB on the JVM?
Yes — Kotlin data classes are valid Java classes. Add JAXB annotations alongside the kotlinx ones (@XmlRootElement, @XmlElement, @XmlAttribute) and provide a no-arg constructor with all-default parameters or use @JvmOverloads. JAXB will read its annotations; XmlUtil ignores them.
How are XML attributes mapped to Kotlin properties?
XML attributes (e.g. <book id="bk101">) become val properties annotated with @XmlSerialName("id") @XmlElement(false). The @XmlElement(false) marker tells the XmlUtil decoder this property is an attribute, not a child element. Element children get @XmlSerialName only.
How are repeated elements like <tag> in <tags> represented?
Repeated child elements become a List<TagType> property on the parent data class. XmlUtil unwraps each repeated element into one list entry. For wrapped lists (an outer <tags> containing inner <tag>) add @XmlChildrenName("tag") on the list property.
What about XML namespaces?
Namespace-qualified elements use the namespace argument: @XmlSerialName(value = "book", namespace = "http://example.com/ns", prefix = "ex"). The basic generator strips namespaces; for namespaced binding rewrite the annotation with all three arguments and XmlUtil will match exactly.
Can elements with both attributes and text content be modeled?
Yes. <price currency="USD">44.99</price> generates a Price data class with two properties — currency annotated with @XmlSerialName("currency") @XmlElement(false) and a value field annotated with @XmlValue. XmlUtil decodes the text body into the @XmlValue property while reading the attribute separately.
Is the XML I paste sent to your servers?
No. XML is parsed by the browser DOMParser and the Kotlin code is generated entirely in JavaScript on your machine. Open DevTools → Network and you will see no requests when you click Convert. Safe for SOAP responses and configuration files containing API keys or credentials.
How do I decode XML into the generated data class?
Use XmlUtil: val xml = XML { defaultPolicy { ignoreUnknownChildren() } }; val book = xml.decodeFromString<Book>(xmlString); — the annotated properties are populated automatically. Add the dependency io.github.pdvrieze.xmlutil:serialization-jvm (or -android, -js) and apply the kotlinx-serialization plugin.