title: Go Parse XML to struct by tag attribute
body: <p>I'm trying to parse the following XML by attribute and value.</p>
  
  <pre><code>&lt;result name="response" numFound="10775" start="0" maxScore="0.59509283"&gt;
      &lt;doc&gt;
          &lt;str name="cui"&gt;c0162311&lt;/str&gt;
          &lt;str name="display_title"&gt;Androgenetic alopecia&lt;/str&gt;
          &lt;str name="source"&gt;GHR&lt;/str&gt;
          &lt;str name="source_url"&gt;http://ghr.nlm.nih.gov/condition/androgenetic-alopecia&lt;/str&gt;
          &lt;float name="score"&gt;0.59509283&lt;/float&gt;
      &lt;/doc&gt;
  </code></pre>
  
  <p>I've come up with the following</p>
  
  <pre><code>type Response struct {
      StrDoc []Str `xml:"result&gt;doc"`
  }
  
  type Str struct {
      Doc   []Doc   `xml:"str"`
      Score []Score `xml:"float"`
  }
  
  type Doc struct {
      Key   string `xml:"name,attr"`
      Value string `xml:",chardata"`
  }
  
  type Score struct {
      Score string `xml:",chardata"`
  }
  </code></pre>
  
  <p>which produces </p>
  
  <pre><code>  "StrDoc": [
      {
        "Doc": [
          {
            "Key": "cui",
            "Value": "c0162311"
          },
          {
            "Key": "display_title",
            "Value": "Androgenetic alopecia"
          },
          {
            "Key": "source",
            "Value": "GHR"
          },
          {
            "Key": "source_url",
            "Value": "http://ghr.nlm.nih.gov/condition/androgenetic-alopecia"
          }
        ],
        "Score": [
          {
            "Score": "0.59509283"
          }
        ]
      },
  </code></pre>
  
  <p>The desired output would be </p>
  
  <pre><code>"Doc": [
              {
                "cui": "c0162311",
                "display_title": "Androgenetic alopecia",
                "source": "GHR",
                "Value": "GHR",
                "source_url": "http://ghr.nlm.nih.gov/",
                "Score": "0.59509283"
              }
            ]
  </code></pre>
  
  <p>I've been trying to achieve this for hours and I haven't found a way yet.</p>