title: Golang - unmarshal extra XML attributes
body: <p>Is there a way to unmarshal XML tags with dynamic attributes (I don't know which attributes I'll get every time).</p>
  
  <p>Maybe it's not supported yet. See <a href="https://code.google.com/p/go/issues/detail?id=3633" rel="nofollow">Issue 3633: encoding/xml: support for collecting all attributes</a></p>
  
  <p>Something like :</p>
  
  <pre><code>package main
  
  import (
      "encoding/xml"
      "fmt"
  )
  
  func main() {
      var v struct {
          Attributes []xml.Attr `xml:",any"`
      }
  
      data := `&lt;TAG ATTR1="VALUE1" ATTR2="VALUE2" /&gt;`
  
      err := xml.Unmarshal([]byte(data), &amp;v)
      if err != nil {
          panic(err)
      }
      fmt.Println(v)
  }
  </code></pre>