-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v0.90.3] List<@Polymorphic Any> doesn't support defaultDeserializer #256
Comments
Unfortunately the error message isn't particularly clear. What happens in this case is that the system tries to find a mapped serializer (note that there is a complex tag ←→ serialname mapping going on here). If it doesn't find one, it tries to find a single serializer that implements the I've been checking, this is not a simple case to handle as the default xml approach doesn't actually record the full type name of the element (but the polymorphic parser still wants that). As a workaround you can just add |
I better understand the issue now, very insightful thanks ! I just tried the workaround registering an We filter unhandled values anyway, it was mainly to avoid any throw which could break the Thanks again for your help. |
There is even an additional feature in that recovery will attempt to detect recovery that doesn't consume a tag and consume it instead.
@AdrienDaily I've managed to get the first half working (triggering the unknown child handler). Have a look at my test for your case: https://github.com/pdvrieze/xmlutil/blob/dev/serialization/src/commonTest/kotlin/nl/adaptivity/xml/serialization/regressions/StringOrCompositePolymorphism253.kt Element should also work (make sure to use the correct Element type: nl.adaptivity.xmlutil.dom2.Element) that uses the correct element parser. |
I've just updated the code and it should work in the current dev branch (In principle it should end up as a snapshot release soon - but oss has been a bit patchy lately). |
There is some further work in dev on this (including ignoring whitespace) |
Hello,
I'm having trouble to have a fallback on a List<@polymorphic Any> with optional children (non handled atm).
Given this example XML:
I'm trying to solve it like this:
I also tried using:
And the parser setup:
I also tried using a wrapper but couldn't solve the issue with the string type as I can't use it as a subclass of a specific wrapper type.
The error I get when trying to parse this country field (that we don't handle ATM so just returning null or an empty class like the Unknown one would be fine)
The unknownChildHandler seems to not be used as a fallback either.
I tried removing the default serializer without success.
Thanks again for your help !
The text was updated successfully, but these errors were encountered: