I'm dealing with parsing XML in the wild that is occasionally inconsistent about specifying the correct/expected namespace for certain tags, or for that matter, any namespace at all. While I'd like serialization to include the correct namespace, when deserializing, I really only want to look at the tag name and can safely ignore the namespace value altogether. (Most other applications parsing this particular type of XML file already do so).
I'm not seeing an easy way to accomplish this; I don't think an unknown child handler can work here because the child isn't treated as unknown; it matches the expected @Serializable class with that tag name but then fails because the namespace doesn't match the expected one for that class, resulting in this error.
Did I miss an API for this? If not, this would be a helpful feature request. In the mean time, I've resorted to manually doing find-and-replace tweaks to the raw content to try to normalize the namespaces before parsing.
I'm dealing with parsing XML in the wild that is occasionally inconsistent about specifying the correct/expected namespace for certain tags, or for that matter, any namespace at all. While I'd like serialization to include the correct namespace, when deserializing, I really only want to look at the tag name and can safely ignore the namespace value altogether. (Most other applications parsing this particular type of XML file already do so).
I'm not seeing an easy way to accomplish this; I don't think an unknown child handler can work here because the child isn't treated as unknown; it matches the expected
@Serializableclass with that tag name but then fails because the namespace doesn't match the expected one for that class, resulting in this error.Did I miss an API for this? If not, this would be a helpful feature request. In the mean time, I've resorted to manually doing find-and-replace tweaks to the raw content to try to normalize the namespaces before parsing.