-
Notifications
You must be signed in to change notification settings - Fork 43
Unable to deserialise CompactFragment annotated with @XmlValue #269
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workingindevThe issue is fixed/implemented in the dev branchThe issue is fixed/implemented in the dev branch
Description
If we have some XML that looks something like:
<root attribute="value"><child>Hello</child><child>World!</child></root>There may be use cases where we wish to partially decode this as a data class such as
@Serializable
@XmlSerialName("root")
data class Root(
val attribute: String,
@XmlValue val tagSoup: CompactFragment?
)
// Expected
Root(
attribute = "value",
tagSoup = CompactFragment("<child>Hello</child><child>World!</child>")
)so that we can directly retrieve the nested tag soup as a raw string, whilst separately accessing the parsed attribute.
However, attempting to deserialise with this pattern throws nl.adaptivity.xmlutil.serialization.XmlSerialException: End document in unexpected location.
This can be successfully deserialised using List<CompactFragment>, however in that case there is no clear way to transform to/from a singular string for the list of compact fragments.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingindevThe issue is fixed/implemented in the dev branchThe issue is fixed/implemented in the dev branch