-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
Deserialization fails with XmlMapper
and DeserializationFeature.UNWRAP_ROOT_VALUE
#374
Comments
For sake of completeness (and since example above is missing a key piece, XML document), test itself is:
which actually does not look right, wrt expected XML. I am not sure if root-wrapping/unwrapping is actually expected to work with XML -- partly since the reason it exists is mostly/only to allow for working around issues CAUSED by some frameworks that add extra wrapping on JSON output.
Another possibility, for retaining at least symmetry, would be to not add wrapping, but also not to try to unwrap (regardless of setting) on reading side. |
I think I am actually inclined to work on changing things in 2.11 so that both Expectation of root wrapping (or not) is handled quite differently on ser, deser:
So, wrt (2), maybe should handle this from calling side. For |
Where there's will there's a way. So returning to this issue now; fix imminent. |
XmlMapper
and DeserializationFeature.UNWRAP_ROOT_VALUE
Hi @cowtowncoder, what is the fix after all? Can we still achieve root element unwrapping? If so, how? |
@ionel-sirbu-crunch Unwrapping in XML has different semantics than with JSON so that feature does nothing with XML. Fix is to prevent attempts for unwrapping since that will not work the way databind would try to apply it. For your specific problem, please file a new issue with reproduction (showing what specifically you think is failing) and include information on versions where things appeared to work. |
Created #485 for that matter. Thank you! |
Note: as per #485 the behavior WILL CHANGE for 2.13.0 so that:
Second issue may be addressed with a later version (2.14 or later) but first we will want to get back to 2.11 baseline compatibility. |
Simple Test case: https://github.com/dewarim/jackson-xml-debug
Using jackson-dataformat-xml version 2.10.1 @ Java 11
Given: a POJO:
When trying to do
I get:
com.fasterxml.jackson.databind.exc.MismatchedInputException: Root name 'id' does not match expected ('Root') for type [simple type, class test.debug.Root]
at [Source: (StringReader); line: 1, column: 7] (through reference chain: test.debug.Root["id"])
The text was updated successfully, but these errors were encountered: