title: How to serialize an object with xml string as field to xml and set property name for this field (Jackson Object Mapper)?
body: <p>I'm trying to serialize an object to xml with Object Mapper. An object's field is a xml string itself. I use @JsonRawValue so Jackson won't escape xml charactets, like <code>&lt;</code> or <code>/&gt;</code>. But, with @JsonRawValue Jackson ignores @JacksonXmlProperty annotation, and writes the string directly, omitting property name.</p>
  
  <p>So this code:</p>
  
  <pre><code>public class Example {
     @JsonRawValue
     @JacksonXmlProperty(localName = "SOME_NAME")
     private String xml = "&lt;xmlExample&gt;123&lt;/xmlExample&gt;";
  }
  </code></pre>
  
  <p>produces:</p>
  
  <pre><code>&lt;Example&gt; &lt;xmlExample&gt;123&lt;/xmlExample&gt; &lt;/Example&gt;
  </code></pre>
  
  <p>When i want:</p>
  
  <pre><code>&lt;Example&gt;
      &lt;SOME_NAME&gt; &lt;xmlExample&gt;123&lt;/xmlExample&gt; &lt;/SOME_NAME&gt;
  &lt;/Example&gt;
  </code></pre>
  
  <p>So the proplem is that @JacksonXmlProperty doesn't work with @JsonRawValue. And i don't know how to get rid of @JsonRawValue, because without this annotation, Jackson escapes some xml characters.</p>
  
  <p>UPDATE: Output generation code: </p>
  
  <pre><code>Example example = new Example();
  String s = new XmlMapper().vriteValueAsString(example);
  </code></pre>