我試圖解組以下XML,但收到錯誤。<ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2011-08-01"><Items><Item><ASIN>B005XSS8VC</ASIN></Item></Items>這是我的結構:type Product struct { XMLName xml.Name `xml:"Item"` ASIN string}type Result struct { XMLName xml.Name `xml:"ItemSearchResponse"` Products []Product `xml:"Items"`}錯誤的文本是“期望的元素類型,<Item>但是有<Items>”,但是我看不到哪里出錯了。任何幫助表示贊賞。v := &Result{Products: nil}err = xml.Unmarshal(xmlBody, v)
- 2 回答
- 0 關注
- 226 瀏覽
添加回答
舉報
0/150
提交
取消