I am new in Golang and I've been trying to parse an xml in Go by defining structs and using xml.Unmarshal.There's no error thrown but the struct is empty. this is my xml:
var bodyXML = []byte('<?xml version="1.0" encoding="ISO-8859-1"?>
<smsBatchResponse>
<ok>
<![CDATA[CHECK_OK]]>
</ok>
</smsBatchResponse>')
and this is my code:
type SmsBatchResponse struct {
Ok string `xml:"ok"`
}
var result SmsBatchResponse
xml.Unmarshal(bodyXML,result)
fmt.Println(result)