How does a simple xml element unmarshal to a golang struct?
问题 Assume the following xml element, with an attribute and a floating point value: <thing prop="1"> 1.23 </thing> <thing prop="2"> 4.56 </thing> In order to unmarshal it, how should I define my struct? type ThingElem struct { Prop int `xml:"prop,attr"` Value float // ??? } type ThingWrapper struct { T ThingElem `xml:"thing"` } // VS type ThingElem struct { XMLName xml.Name `xml:"thing"` // Do I even need this? Prop int `xml:"prop,attr"` Value float // ??? } The usage of the XMLName Property