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
+14.2k Golang : Convert IP version 6 address to integer or decimal number
+11.2k CodeIgniter : How to check if a session exist in PHP?
+15.6k Golang : Force download file example
+7.8k Golang : Example of how to detect which type of script a word belongs to
+7.6k Android Studio : AlertDialog to get user attention example
+17k Golang : Get input from keyboard
+4.7k Javascript : Access JSON data example
+14.5k Golang : How to determine if user agent is a mobile device example
+21.1k Golang : For loop continue,break and range
+22.4k Golang : How to read JPG(JPEG), GIF and PNG files ?
+8.2k Golang : Get final or effective URL with Request.URL example
+9.9k Golang : Translate language with language package example