title: Golang: Parse both XML element value and attributes for groups
body: <p>I have an XML structure like this:</p>
  
  <pre><code>&lt;RootLevel status="new" timestamp="1383259529" xmlns="http://someplace.com"&gt;
      &lt;Item active="1" status="new" itemid="451254"&gt;
          &lt;SubItem active="1" recent="false" usertext="No idea" id="78421"&gt;
              &lt;SubItemField active="1" ready="no" type="1"&gt;1.4&lt;/SubItemField&gt;
              &lt;SubItemField active="1" ready="yes" type="2"&gt;4.5&lt;/SubItemField&gt;
          &lt;/SubItem&gt;
      &lt;/Item&gt;
  &lt;/RootLevel&gt;
  </code></pre>
  
  <p>I don't know how I can gather both values and attributes for the SubItemField elements, my code is something like:</p>
  
  <pre><code>type RootLEvel struct {
      XMLName xml.Name `xml:"RootLevel"`
      ...
      Item    []Item
  }
  
  type Item struct {
      ...
      SubItem   []SubItem
  }
  
  type SubItem struct {
      ...
      SubItemField    []SubItemField
  }
  
  type SubItemField struct {
      Active bool `xml:"active,attr"`
      Ready string `xml:"ready,attr"`
  }
  </code></pre>
  
  <p>I need both attributes and values but the only way to get values that I know is just use</p>
  
  <pre><code>SubItemField  []float32
  </code></pre>
  
  <p>instead of my custom type. I am using xml.Unmarshal btw.</p>
  
  <p>Any idea?</p>
  
  <p>Thanks.</p>