pdvrieze / xmlutil

XML Serialization library for Kotlin
https://pdvrieze.github.io/xmlutil/
Apache License 2.0
363 stars 30 forks source link

Support for multiple alternative names during parsing? #174

Open Guimareshh opened 10 months ago

Guimareshh commented 10 months ago

Hello! First of all all thanks for this amazing library!

I was wondering if it's possible to have multiple names during parsing? Like @JsonNames in Kotlin.Serialization. Currently @XmlSerialName is not repeatable.

Thanks!

pdvrieze commented 10 months ago

You're welcome. Currently there is no direct support for matching broader names. This doesn't mean you can not make this work. I may provide more direct support but it would work the same way as the explicit way (just provide some convenience).

The explicit way is to use a filtering XmlReader (rather than directly deserializing from string/reader/inputstream - the directs are just shortcuts). The filter can then apply renames as needed (without having to make the serialization itself even more complex).

ps. the serialization plugin doesn't support repeatable annotations (only one is retained)

Guimareshh commented 10 months ago

Thanks for your answer, I might use a filtering XmlReader then!