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
+5.2k Responsive Google Adsense
+30.4k Golang : How to verify uploaded file is image or allowed file types
+5.2k Golang : The Tao of importing package
+11.7k Golang : How to detect a server/machine network interface capabilities?
+19k Golang : Padding data for encryption and un-padding data for decryption
+5.6k Golang : Detect words using using consecutive letters in a given string
+39k Golang : How to iterate over a []string(array)
+10.5k Generate Random number with math/rand in Go
+8.8k Golang : Gorilla web tool kit schema example
+18.6k Golang : Find IP address from string
+11.3k Golang : Fix fmt.Scanf() on Windows will scan input twice problem