Ryan Smith
04/28/2023, 12:23 AMRyan Smith
04/28/2023, 12:29 AMdata class Model(
name: String = "default",
text: String = "",
attributes: Map<String, String> = emptyMap(),
children: Collection<Model> = emptyList()
)
Given an instance like this:
val model = Model(
name = "parent",
attributes = mapOf("attribute" to "value"),
children = listOf(
Model(
name = "child",
text = "child text"
)
)
)
The xml would look like:
<parent attribute="value">
<child>child text</child>
</parent>
Ryan Smith
04/28/2023, 12:30 AMandyg
05/05/2023, 5:35 AMModel
.Ryan Smith
05/06/2023, 3:21 PM@XmlOtherAttributes
, which has helped significantly because it takes care of Model::attributes
. Model::children
is handled inherently, so it's just down to the dynamic names and text and I think XmlDelegatingTagWriter
might be the only way.