FasterXML / FasterXML/jackson-dataformat-xml

Polymorphic deserialization based on root tag

Open
#537 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
631
Forks
246
Avg merge
7d 9h
Merged PRs (30d)
13

Description

Hello!
I am not sure if this is a help or a feature request. I scoured google/SO trying to dynamically select target class based on the root tag. I expected the usage to be something like this:
```java
xmlMapper.readValue(data, MyAbstractPojo.class)
```
where `MyAbstractPojo` is annotated with `@JsonTypeInfo` and `@JsonSubTypes` to configure type selection. However, root tag is not a property, not an external property and not a wrapper object, which means it's not helpful to use those. Even if you use `DEDUCTION` as a mechanism, only property names are considered, root tag is again ignored.

So I wanted to ask whether I have missed something obvious, and if I did not, consider implementing this feature for the XML module.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.