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
+17.6k Golang : delete and modify XML file content
+19.2k Golang : Check whether a network interface is up on your machine
+4.3k Javascript : How to show different content with noscript?
+19.1k Golang : Display list of time zones with GMT
+24.6k Golang : How to print rune, unicode, utf-8 and non-ASCII CJK(Chinese/Japanese/Korean) characters?
+13.1k Golang : Convert(cast) uintptr to string example
+22.1k Golang : Repeat a character by multiple of x factor
+8.2k Android Studio : Rating bar example
+20.8k Golang : Convert date string to variants of time.Time type examples
+4.8k Facebook : How to place save to Facebook button on your website
+18.8k Golang : How to make function callback or pass value from function as parameter?
+6.9k Golang : How to solve "too many .rsrc sections" error?