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
+16.1k Golang : Generate universally unique identifier(UUID) example
+14.5k Golang : Overwrite previous output with count down timer
+21.5k Golang : How to read float value from standard input ?
+12.6k Golang : Get absolute path to binary for os.Exec function with exec.LookPath
+14.4k Golang : How to pass map to html template and access the map's elements
+35.3k Golang : Strip slashes from string example
+11.7k Golang : How to detect a server/machine network interface capabilities?
+23.5k Golang : Get ASCII code from a key press(cross-platform) example
+11.1k Golang : Simple image viewer with Go-GTK
+4.6k MariaDB/MySQL : How to get version information
+47.8k Golang : Convert int to byte array([]byte)
+8.6k Golang : Another camera capture GUI application with GTK and OpenCV