title: parsing HashMap into xml with Simple XML - JAVA
body: <p>I need to put the values inside a pat as the values of my XML file for Ex:</p>
  <pre><code>Map&lt;String, String&gt; props = new HashMap&lt;&gt;();
  props.put(&quot;role&quot;, &quot;Admin&quot;);
  props.put(&quot;externalId&quot;, &quot;2ew1Q&quot;);
  props.put(&quot;Property&quot;, &quot;internal&quot;);
  props.put(&quot;Execution&quot;, &quot;internal&quot;);
  </code></pre>
  <p>My expected output should be:</p>
  <pre><code>&lt;role&gt;Admin&lt;/role&gt;
  &lt;externalId&gt;2ew1Q&lt;/externalId&gt;
  &lt;Property&gt;internal&lt;/Property&gt;
  &lt;Execution&gt;internal&lt;/Execution&gt;
  </code></pre>
  <p>But instead of it, I'm getting</p>
  <pre><code>&lt;entry string=&quot;role&quot;&gt;Admin&lt;/entry&gt;
  &lt;entry string=&quot;Execution&quot;&gt;internal&lt;/entry&gt;
  &lt;entry string=&quot;externalId&quot;&gt;2ew1Q&lt;/entry&gt;
  &lt;entry string=&quot;Property&quot;&gt;internal&lt;/entry&gt;
  </code></pre>
  <p>I have to do it with Simple XML, and this is my code:</p>
  <pre><code>    @Root
      public class Data {
      
          @ElementMap(entry = &quot;property&quot;, key = &quot;key&quot;, attribute = true, inline = true)
          private Map&lt;String, String&gt; customProps;
      
          public Map&lt;String, String&gt; getData() {
              return customProps;
          }
      
          public void setData(Map&lt;String, String&gt; data) {
              this.customProps = data;
          }
      }
  
  
  public static void main(String[] args) throws Exception {
  
          Map&lt;String, String&gt; props = new HashMap&lt;&gt;();
  
          props.put(&quot;role&quot;, &quot;Admin&quot;);
          props.put(&quot;externalId&quot;, &quot;2ew1Q&quot;);
          props.put(&quot;Property&quot;, &quot;internal&quot;);
          props.put(&quot;Execution&quot;, &quot;internal&quot;);
  
  
          Data customProps = new Data();
          customProps.setData(props);
  
          Serializer serializer = new Persister();
          File result = new File(&quot;example.xml&quot;);
          serializer.write(customProps, result);
  }
  </code></pre>