Documentation ¶
Overview ¶
Package xml has some utilities for XML codec
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StructToXML ¶
StructToXML convert struct to XML The struct must have xml tags
:param interFace: The struct data with xml tags
Example
var a NTP thing, err := xml.StructToXML(a) fmt.Println(thing)
func XMLToStruct ¶
XMLToStruct convert XML to a Struct The struct must have xml tags
:param interFace: A pointer to a variable of the struct data with xml tags :param xmlData: The XML data
Example
type NTP struct { NTPServersData struct { SourceInterface string `yaml:"source_interface" json:"source_interface" xml:"source_interface"` NTPServerKey []struct { IPv4Host string `yaml:"ipv4_host" json:"ipv4_host" xml:"ipv4_host"` Priority bool `yaml:"priority" json:"priority" xml:"priority"` } `yaml:"ntp_servers" json:"ntp_servers" xml:"ntp_servers"` } `yaml:"ntp" json:"ntp" xml:"ntp"` } var a NTP err := json.XMLToStruct(&a, ntpXml) if err != nil { log.Fatal(err) } fmt.Println(a)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.