I am using the simple-xml library (https://simple.sourceforge.net/home.php) to deserialize a list of string elements.
<Parent>
<PropertyList>
<Entry>image/png</Entry>
<Entry>application/atom+xml</Entry>
<Entry>application/json;type=utfgrid</Entry>
Which I successfully deserialize with:
data class PropertyList(
@field:ElementList(name = "Entry", inline = true)
var entries: List<Entry> = mutableListOf()
)
@Root(name = "Entry", strict = false)
class Entry(
@field:Text
var entry: String? = null
)
However I am trying to figure out if I can remove the extra Entry class and just deserialize into a list of Strings:
data class PropertyList(
@field:ElementList(name = "Entry", inline = true)
var entries: List<String> = mutableListOf()
)
When I try that I end up with an empty list. Is this possible?
from Deserialize a list of string elements w/ simple-and and retrofit on Android
No comments:
Post a Comment