Golang encoding/xml.NewDecoder() function example
package encoding/xml
NewDecoder creates a new XML parser reading from r(1st parameter). If r does not implement io.ByteReader, NewDecoder will do its own buffering.
Golang encoding/xml.NewDecoder() function usage example
func buildError(r *http.Response) error {
err := Error{}
err.StatusCode = r.StatusCode
err.StatusMsg = r.Status
xml.NewDecoder(r.Body).Decode(&err) // <--- here
return &err
}
Reference :
Advertisement
Something interesting
Tutorials
+6.4k Golang : How to search a list of records or data structures
+15.6k Chrome : ERR_INSECURE_RESPONSE and allow Chrome browser to load insecure content
+12.9k Golang : Convert IPv4 address to packed 32-bit binary format
+14.8k Golang : Find commonalities in two slices or arrays example
+5.4k Unix/Linux : How to archive and compress entire directory ?
+36.3k Golang : Convert(cast) int64 to string
+12.7k Android Studio : Highlight ImageButton when pressed on example
+5.8k Unix/Linux : Get reboot history or check when was the last reboot date
+14.2k Elastic Search : Mapping date format and sort by date
+5.7k Get website traffic ranking with Similar Web or Alexa
+21.8k Golang : Convert string slice to struct and access with reflect example
+9k Golang : automatically figure out array length(size) with three dots