Go Newb here... I know there is an issue with my struct but cant seem to get it working.... any advice much appreciated!
<?xml version='1.0' ?>
<result called_on="2015-06-17 12:49:41.014435+00">
<entities count="0" start="0">
<entity name="Aaron Test" id="12345" type="organization" />
<entity name="MagicOne" id="102301" type="organization" />
</entities>
<status code="ok" />
</result>
type OrgResult struct {
XMLName xml.Name `xml:"result"`
Entities OrgEntities `xml:"entity"`
}
type OrgEntities struct {
Org OrgEntity `xml:"entity"`
}
type OrgEntity struct {
ID int `xml:"id,attr"`
Name string `xml:"name,attr"`
Type string `xml:"type,attr"`
}
OrgResult := OrgResult{}
xml.Unmarshal(body, &OrgResult)
fmt.Println(body)
fmt.Println(OrgResult)
got it :)
type OrgResult struct {
XMLName xml.Name `xml:"result"`
Entities OrgEntities `xml:"entities"`
}
type OrgEntities struct {
Org []OrgEntity `xml:"entity"`
}
type OrgEntity struct {
ID int `xml:"id,attr"`
Name string `xml:"name,attr"`
Type string `xml:"type,attr"`
}