1
我有一個看起來像這樣的XML:解析簡單值的XML數組中去
<MyElement>
<Ids>
<int>1</int>
<int>2</int>
</Ids>
</MyElement>
我覺得挑戰中去分析。我試過以下
type MyElement struct {
Ids int[]
}
甚至
type Ids struct {
id int[] `xml:"int"`
}
type MyElement struct {
Ids Ids
}
但它永遠不會回升。
困難在於所有元素都被稱爲int並且只存儲一個int值,而不是通常的鍵/值對。