xmlutil icon indicating copy to clipboard operation
xmlutil copied to clipboard

Deserializing attributes with a prefix (but no namespace behind it) fails

Open boswelja opened this issue 4 months ago • 1 comments

I have some XML

<entry xml:lang="dut">Entry</entry>

Which notably has NO namespace definitions (or other langs)

and a corresponding data class

@Serializable
@XmlElement(value = true)
@SerialName(value = "entry")
data class Entry(
  @XmlElement(value = false)
  @SerialName(value = "xml:lang")
  @XmlSerialName(prefix = "xml", value = "lang")
  val lang: String = "eng"
)

I was expecting to see Entry.lang populated as dut for this example, but instead I get back eng, which is the default value. There are no errors thrown to indicate that the xml:lang attr couldn't be deserialized either.

I'm no expert in XML, am I missing something here?

boswelja avatar Jun 22 '25 04:06 boswelja