我正在使用 Golang 来读取 XML 响应。我无法正确读取带空格的值。
这是一个要点:https ://gist.github.com/anonymous/5825288
有没有办法让 xml.Unmarshal 修剪值<result>
,然后将其视为 int?
IE
<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.