FasterXML / FasterXML/jackson-dataformat-xml
Jackson XML reading mixed sibling nodes "overwriting" issue
- 主要语言
- Java
- 星标
- 631
- 派生
- 246
- 平均合并
- 7 天 9 小时
- 30 天内合并 PR
- 13
描述
Jackson seems to be overwriting the older sibling nodes if the order is mixed. See below test case. Seems to be a bug. Thanks.
@JacksonXmlRootElement
data class RootNode(
@JacksonXmlElementWrapper(useWrapping = false)
@JacksonXmlProperty(localName = "NodeA")
val nodeA: List,
@JacksonXmlProperty(localName = "NodeB")
val nodeB: NodeB
)
data class NodeA(
@JacksonXmlProperty(localName = "attr", isAttribute = true)
val attr: String
)
data class NodeB(
@JacksonXmlProperty(localName = "attr", isAttribute = true)
val attr: String
)
class ReadXMLTest {
@Test
fun canRead() {
val xml = """
""".trimIndent()
val xmlMapper = XmlMapper()
xmlMapper.registerModule(kotlinModule())
assertEquals(
RootNode(
listOf(NodeA("123"), NodeA("456")),
NodeB("ABC")
),
xmlMapper.readValue(xml)
)
}
}
This fails with
Expected :RootNode(nodeA=[NodeA(attr=123), NodeA(attr=456)], nodeB=NodeB(attr=ABC))
Actual :RootNode(nodeA=[NodeA(attr=456)], nodeB=NodeB(attr=ABC))
If the XML is like below, then it passes.
贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。