Jackson XML Serialization XMLElementRef name
<p>Hello I need to configure fastxml.Jackson Serializer to work exactly as a default JAXB Serializer.</p>

<p>I have the following case with two classes:</p>

<pre><code>@XmlRootElement(name = "elA")
public class A {
    @XmlElementRef
    public Collection&lt;B&gt; getBs() {
        return this.bs;
    }
}

@XmlRootElement(name = "elB")
public class B {

}
</code></pre>

<p>My Object Mapper config looks like this:</p>

<pre><code>XmlMapper objectMapper = new XmlMapper();
JaxbAnnotationModule jaxbAnnotationModule = new JaxbAnnotationModule();
objectMapper.registerModule(jaxbAnnotationModule);

objectMapper.setDefaultUseWrapper(false);
objectMapper.configure(SerializationFeature.INDENT_OUTPUT,true);
objectMapper.configure(SerializationFeature.WRAP_ROOT_VALUE,false);
objectMapper.configure(SerializationFeature.CLOSE_CLOSEABLE, true);
objectMapper.setSerializationInclusion(Include.NON_ABSENT);

JaxbAnnotationIntrospector jaxbAnnotationIntrospector = new XmlJaxbAnnotationIntrospector(objectMapper.getTypeFactory());
objectMapper.setAnnotationIntrospector(jaxbAnnotationIntrospector);
</code></pre>

<p>I need to configure ObjectMapper for Jackson Serializer to produce the following XML</p>

<pre><code>&lt;elA&gt;
   &lt;elB&gt;&lt;/elB&gt;
   &lt;elB&gt;&lt;/elB&gt;
&lt;/elA&gt;
</code></pre>

<p>But I get this:</p>

<pre><code>&lt;A&gt;
    &lt;bs&gt;&lt;/bs&gt;
    &lt;bs&gt;&lt;/bs&gt;
&lt;/A&gt;
</code></pre>

<p>How should I configure Object Mapper to get the expected result? Thank you. </p>

<p>I cannot change neither classes nor annotations since this is part of framework.</p>

<p>The only things I can influence are ObjectMapper and Jackson configurations.</p>