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
+10.2k Golang : How to profile or log time spend on execution?
+24.6k Golang : How to print rune, unicode, utf-8 and non-ASCII CJK(Chinese/Japanese/Korean) characters?
+9.1k Golang : Simple histogram example
+12.4k Golang : Search and extract certain XML data example
+6.3k Golang : Detect face in uploaded photo like GPlus
+6.1k Golang : Scan forex opportunities by Bollinger bands
+7.5k Golang : Shuffle strings array
+9.7k Golang : Eroding and dilating image with OpenCV example
+15k Golang : package is not in GOROOT during compilation
+9.5k Mac OSX : Get a process/daemon status information
+4.9k Python : Find out the variable type and determine the type with simple test
+5.3k Golang : Generate Interleaved 2 inch by 5 inch barcode