title: Unmarshal XML Array in Golang: Only Getting The First Element
body: <p>Code:</p>
  
  <pre><code>type HostSystemIdentificationInfo []struct {
      IdentiferValue string `xml:"identifierValue"`
      IdentiferType  struct {
          Label   string `xml:"label"`
          Summary string `xml:"summary"`
          Key     string `xml:"key"`
      } `xml:"identifierType"`
  }
  
  func vsphereHost(v *vsphere.Vsphere, md *opentsdb.MultiDataPoint) error {
      res, err := v.Info("HostSystem", []string{
          "name",
          "summary.hardware.cpuMhz",
          "summary.hardware.memorySize", // bytes
          "summary.hardware.numCpuCores",
          "summary.hardware.numCpuCores",
          "summary.quickStats.overallCpuUsage",    // MHz
          "summary.quickStats.overallMemoryUsage", // MB
          "summary.hardware.otherIdentifyingInfo",
          "summary.hardware.model",
      })
      for _, r := range res {
          for _, p := range r.Props {
              if p.Name == "summary.hardware.otherIdentifyingInfo" {
                  var t HostSystemIdentificationInfo
                  fmt.Println(p.Val.Inner)
                  err := xml.Unmarshal([]byte(p.Val.Inner), &amp;t)
                  if err != nil {
                      return err
                  }
                  fmt.Println(t)
              }
          }
      }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>&lt;HostSystemIdentificationInfo xsi:type="HostSystemIdentificationInfo"&gt;&lt;identifierValue&gt; unknown&lt;/identifierValue&gt;&lt;identifierType&gt;&lt;label&gt;Asset Tag&lt;/label&gt;&lt;summary&gt;Asset tag of the system&lt;/summary&gt;&lt;key&gt;AssetTag&lt;/key&gt;&lt;/identifierType&gt;&lt;/HostSystemIdentificationInfo&gt;&lt;HostSystemIdentificationInfo xsi:type="HostSystemIdentificationInfo"&gt;&lt;identifierValue&gt;Dell System&lt;/identifierValue&gt;&lt;identifierType&gt;&lt;label&gt;OEM specific string&lt;/label&gt;&lt;summary&gt;OEM specific string&lt;/summary&gt;&lt;key&gt;OemSpecificString&lt;/key&gt;&lt;/identifierType&gt;&lt;/HostSystemIdentificationInfo&gt;&lt;HostSystemIdentificationInfo xsi:type="HostSystemIdentificationInfo"&gt;&lt;identifierValue&gt;5[0000]&lt;/identifierValue&gt;&lt;identifierType&gt;&lt;label&gt;OEM specific string&lt;/label&gt;&lt;summary&gt;OEM specific string&lt;/summary&gt;&lt;key&gt;OemSpecificString&lt;/key&gt;&lt;/identifierType&gt;&lt;/HostSystemIdentificationInfo&gt;&lt;HostSystemIdentificationInfo xsi:type="HostSystemIdentificationInfo"&gt;&lt;identifierValue&gt;REDACTED&lt;/identifierValue&gt;&lt;identifierType&gt;&lt;label&gt;Service tag&lt;/label&gt;&lt;summary&gt;Service tag of the system&lt;/summary&gt;&lt;key&gt;ServiceTag&lt;/key&gt;&lt;/identifierType&gt;&lt;/HostSystemIdentificationInfo&gt;
  [{ unknown {Asset Tag Asset tag of the system AssetTag}}]
  &lt;HostSystemIdentificationInfo xsi:type="HostSystemIdentificationInfo"&gt;&lt;identifierValue&gt; unknown&lt;/identifierValue&gt;&lt;identifierType&gt;&lt;label&gt;Asset Tag&lt;/label&gt;&lt;summary&gt;Asset tag of the system&lt;/summary&gt;&lt;key&gt;AssetTag&lt;/key&gt;&lt;/identifierType&gt;&lt;/HostSystemIdentificationInfo&gt;&lt;HostSystemIdentificationInfo xsi:type="HostSystemIdentificationInfo"&gt;&lt;identifierValue&gt;Dell System&lt;/identifierValue&gt;&lt;identifierType&gt;&lt;label&gt;OEM specific string&lt;/label&gt;&lt;summary&gt;OEM specific string&lt;/summary&gt;&lt;key&gt;OemSpecificString&lt;/key&gt;&lt;/identifierType&gt;&lt;/HostSystemIdentificationInfo&gt;&lt;HostSystemIdentificationInfo xsi:type="HostSystemIdentificationInfo"&gt;&lt;identifierValue&gt;5[0000]&lt;/identifierValue&gt;&lt;identifierType&gt;&lt;label&gt;OEM specific string&lt;/label&gt;&lt;summary&gt;OEM specific string&lt;/summary&gt;&lt;key&gt;OemSpecificString&lt;/key&gt;&lt;/identifierType&gt;&lt;/HostSystemIdentificationInfo&gt;&lt;HostSystemIdentificationInfo xsi:type="HostSystemIdentificationInfo"&gt;&lt;identifierValue&gt;REDCATED&lt;/identifierValue&gt;&lt;identifierType&gt;&lt;label&gt;Service tag&lt;/label&gt;&lt;summary&gt;Service tag of the system&lt;/summary&gt;&lt;key&gt;ServiceTag&lt;/key&gt;&lt;/identifierType&gt;&lt;/HostSystemIdentificationInfo&gt;
  [{ unknown {Asset Tag Asset tag of the system AssetTag}}]
  </code></pre>
  
  <p>So the problem is when I unmarshal I'm only getting one of the HostSystemIdentification structs in the result instead of the full array. How do I fix this?</p>
  
  <p>Here is a go playground with the problem reduced: <a href="http://play.golang.org/p/5uRJ6Eu8jK" rel="nofollow">http://play.golang.org/p/5uRJ6Eu8jK</a></p>