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
+9k Golang : Get SPF and DMARC from email headers to fight spam
+12.2k Golang : Detect user location with HTML5 geo-location
+25.5k Golang : Generate MD5 checksum of a file
+17.8k Golang : Defer function inside init()
+24.5k Golang : Time slice or date sort and reverse sort example
+6.1k Golang : Debug with Godebug
+7.1k Golang : Squaring elements in array
+10.7k Golang : Interfacing with PayPal's IPN(Instant Payment Notification) example
+7.8k Golang : Getting Echo framework StartAutoTLS to work
+7.1k Golang : Validate credit card example
+5.4k Golang : fmt.Println prints out empty data from struct