我有xml,我想解组到Session struct
type Session struct {
XMLName xml.Name `xml:"response"`
status string `xml:"status,attr`
Result Result `xml:"result"`
}
type Result struct {
tmo_udp string `xml:"tmo-udp"`
tmo_tcp string `xml:"tmo-tcp"`
}
var session Session
xml.Unmarshal(htmlData, &session)
fmt.Println(string(htmlData))
fmt.Println("-------------------------------------------------")
fmt.Println(session)
但在尝试打印时没有任何结果
<response status="success"><result>
<tmo-udp>30</tmo-udp>
<tmo-tcp>3600</tmo-tcp>
</result></response>
-------------------------------------------------
{{ response} { }}