-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Labels
indevThe issue is fixed/implemented in the dev branchThe issue is fixed/implemented in the dev branch
Description
XMLStreaming doesn't convert XML character references. Only tested for attributes, don't know about other places in the XML where XML character references could occur.
This unit test would currently fail:
@Test fun `writer converts character references in attributes`() {
val buffer = StringBuilder()
val writer = xmlStreaming.newWriter(buffer)
writer.startTag("", "test", null)
writer.attribute(null, "attr", null, "With\nlinefeed")
writer.endTag("", "test", null)
assertEquals(
"<test attr=\"With linefeed\"></test>", // or hexadecimal: 

buffer.toString()
)
}
instead, the result looks like this:
<test attr="With
linefeed"></test>
Additional information
This unit test does not fail
@Test fun `reader converts character references in attributes`() {
val source = "<test attr=\"With linefeed\"></test>" // or hexadecimal: 

val reader = xmlStreaming.newReader(source)
forEach {
if (it == START_ELEMENT && localName == "test") {
assertEquals(
"With\nlinefeed",
getAttributeValue(null, "attr")!!
)
}
}
}
mnalis
Metadata
Metadata
Assignees
Labels
indevThe issue is fixed/implemented in the dev branchThe issue is fixed/implemented in the dev branch