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
+41k Golang : How to check if a string contains another sub-string?
+8.1k Golang : Check from web if Go application is running or not
+5.3k Golang : How to deal with configuration data?
+6.5k Elasticsearch : Shutdown a local node
+25.8k Golang : Daemonizing a simple web server process example
+37.5k Golang : Converting a negative number to positive number
+10.9k Golang : Removes punctuation or defined delimiter from the user's input
+7.7k Golang : Command line ticker to show work in progress
+15.6k Golang : rune literal not terminated error
+20.3k Golang : Check if os.Stdin input data is piped or from terminal
+6.5k Golang : Calculate diameter, circumference, area, sphere surface and volume