title: How to map a Java bean to a XML/CSV with mapping customization
body: <p>Here is the result I try to reach: I have a Java bean, and I'd like to map it to an XML file (the problem with CSV is the same). But I need some configurability in my mapping. Let's take an example to illustrate what I'd like to do, it will be better than a long speech :</p>
  
  <pre><code>public class MyBean {
      private String field1;
      private String field2;
      private String field3;
  }
  </code></pre>
  
  <p>I'd like to have the following XML file:</p>
  
  <pre><code>&lt;root&gt;
      &lt;valueA&gt;field1&lt;/valueA&gt;
      &lt;valueB&gt;field2 field3&lt;/valueB&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>The difficulty I have is to be able to customize the mapping between my Java bean fields and my XML fields. There is no direct hard-coded mapping, I need a user need to be able to configure the mapping without changing the code.</p>
  
  <p>At the end, I need to generate several XML with different mappings, that I need to be able to configure through a mechanism of mapping a final user can use (maybe through an UI or whatever else).</p>
  
  <p>Is there any Java tool able to reach this goal? Or any other external tool? I could implement this intelligence by myself, but I'd prefer using some existing tool.</p>
  
  <p>Thanks for any help.</p>