title: Golang marshal dynamic xml element name
body: <p>The xml file consists of two elements. Those elements have the same structure except for one element name. I tried to set a value to the XMLName property, but that didn't work.</p>
  <h2>Xml:</h2>
  <pre><code>&lt;!-- first element --&gt;
  &lt;PERSON&gt;
    &lt;ELEM1&gt;...&lt;/ELEM1&gt;
    &lt;ELEM2&gt;...&lt;/ELEM2&gt;
    &lt;ELEM3&gt;...&lt;/ELEM3&gt;
    &lt;ELEM4&gt;...&lt;/ELEM4&gt;
  &lt;/PERSON&gt;
  
  
  &lt;!-- second element --&gt;
  &lt;SENDER&gt;
    &lt;ELEM1&gt;...&lt;/ELEM1&gt;
    &lt;ELEM2&gt;...&lt;/ELEM2&gt;
    &lt;ELEM3&gt;...&lt;/ELEM3&gt;
    &lt;ELEM4&gt;...&lt;/ELEM4&gt;
  &lt;/SENDER&gt;
  </code></pre>
  <p>Is it possible to define a struct such that the element name is dynamic?</p>
  <pre><code>type Person struct {
      XMLName string `xml:&quot;???&quot;` // How make this dynamic?
      e1 string `xml:&quot;ELEM1&quot;`
      e2 string `xml:&quot;ELEM2&quot;`
      e3 string `xml:&quot;ELEM3&quot;`
      e4 string `xml:&quot;ELEM4&quot;`
  }
  </code></pre>