Created
November 14, 2019 19:17
-
-
Save underlow/4d6d5dc41674dcce44fbfd670b779d8b to your computer and use it in GitHub Desktop.
xmlutil exception
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Serializable | |
data class Tree(val node1: Node1) | |
@Serializable | |
@SerialName("node1") | |
data class Node1( | |
@XmlValue(true) val text: String = "", | |
val subnode1: Subnode1 | |
) | |
@Serializable | |
@SerialName("subnode1") | |
data class Subnode1(@XmlValue(true) val text: String) | |
fun main() { | |
val tree = "<tree><node1><subnode1>text1</subnode1>textTextText</node1></tree>" | |
val tree2 = "<tree><node1>textTextText<subnode1>text1</subnode1></node1></tree>" | |
val format = XML(fbXmlModule) { | |
autoPolymorphic = true | |
unknownChildHandler = { _, _, _, _ -> } | |
} | |
val t = format.parse(Tree.serializer(), tree) | |
println(t) | |
val t2 = format.parse(Tree.serializer(), tree2) | |
println(t2) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment