xmlutil
xmlutil copied to clipboard
Is it possible to output self-closing tags if empty?
By default, empty elements output both a start and end tag:
@Serializable
class Foo(
@XmlElement
val bar: String
)
xml.encodeToString(Foo(""))
Result:
<Foo><bar></bar></Foo>
Is it possible to output a self closing tag instead?
<Foo><bar/></Foo>