Golang encoding/xml.Name type examples
package encoding/xml
A Name represents an XML name (Local) annotated with a name space identifier (Space). In tokens returned by Decoder.Token, the Space identifier is given as a canonical URL, not the short prefix used in the document being parsed.
Golang encoding/xml.Name type usage examples
Example 1:
type ExternalIPAddress struct {
XMLName xml.Name `xml:"NewExternalIPAddress"`
IP string
}
Example 2:
...
bodyBuf := bytes.NewBuffer(nil)
enc := xml.NewEncoder(bodyBuf)
start := xml.StartElement{
Name: xml.Name{
Space: "",
Local: reflect.Indirect(reflect.ValueOf(req)).Type().Name(),
},
Attr: []xml.Attr{{xml.Name{"", "xmlns"}, "http://localhost/xmldoc/2014-08-01/"}},
}
...
Reference :
Advertisement
Something interesting
Tutorials
+12.7k Golang : Sort and reverse sort a slice of bytes
+8k Golang : Get all countries phone codes
+17k Golang : Fix cannot convert buffer (type *bytes.Buffer) to type string error
+11.6k Golang : Concurrency and goroutine example
+16.4k Golang : Convert slice to array
+15.6k Golang : Force download file example
+5.2k Golang : Experimental Jawi programming language
+13.9k Golang : Get current time
+34.6k Golang : How to stream file to client(browser) or write to http.ResponseWriter?
+7.4k Golang : Check to see if *File is a file or directory
+23.7k Find and replace a character in a string in Go
+10.6k Golang : Bubble sort example