0

Golang を使用して XML 応答を読み取ります。スペースを含む値を正しく読み取ることができません。

ここに要点があります:https://gist.github.com/anonymous/5825288

xml.Unmarshal で値をトリムしてから<result>int として扱う方法はありますか?

いえ

<result>1<result> // no spaces, is marshalled correctly.  The resulting value in the struct is 1

しかし

<result> 1 </result>  // with spaces, is marshalled incorrectly as an int.  The resulting value in the struct for result is 0.
4

1 に答える 1