FasterXML / jackson-dataformat-xml

Extension for Jackson JSON processor that adds support for serializing POJOs as XML (and deserializing from XML) as an alternative to JSON
Apache License 2.0
561 stars 221 forks source link

Support use of xsi:type for polymorphic deserialization (FromXmlParser.Feature.AUTO_DETECT_XSI_TYPE) #634

Closed cowtowncoder closed 5 months ago

cowtowncoder commented 5 months ago

(note: counterpart to generation-side #324 just implemented)

It is now possible to serializer POJOs like this one:

    @JsonRootName("Poly")
    @JsonTypeInfo(use = Id.SIMPLE_NAME, include = As.PROPERTY, property="xsi:type")
    static class PolyBean {
        public int value = 42;
    }

resulting in XML like:

<Poly xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='PolyBean'>"
  <value>42</value>
</Poly>

which is all fine; but we also need to support the part, deserialization, for seamless usability. So let's do just that.