Golang encoding/xml.Marshaler type example
package encoding/xml
Marshaler is the interface implemented by objects that can marshal themselves into valid XML elements.
MarshalXML encodes the receiver as zero or more XML elements. By convention, arrays or slices are typically encoded as a sequence of elements, one per entry. Using start as the element tag is not required, but doing so will enable Unmarshal to match the XML elements to the correct struct field. One common implementation strategy is to construct a separate value with a layout corresponding to the desired XML and then to encode it using e.EncodeElement. Another common strategy is to use repeated calls to e.EncodeToken to generate the XML output one token at a time. The sequence of encoded tokens must make up zero or more valid XML elements.
Golang encoding/xml.Marshaler type usage example
marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem()
Reference :
Advertisement
Something interesting
Tutorials
+12.7k Golang : Sort and reverse sort a slice of bytes
+26k Golang : Convert IP address string to long ( unsigned 32-bit integer )
+5.5k Golang : Stop goroutine without channel
+17.1k Golang : XML to JSON example
+46.4k Golang : Encode image to base64 example
+9.6k Golang : How to generate Code 39 barcode?
+6.7k Golang : Output or print out JSON stream/encoded data
+11.3k Golang : Characters limiter example
+9.6k Golang : Quadratic example
+9.4k Golang : Terminate-stay-resident or daemonize your program?
+7.2k Ubuntu : connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream
+8.9k Golang : What is the default port number for connecting to MySQL/MariaDB database ?