标签:name nil image ack attr hal type int ali
/**
序列化
*/
package main
import (
"encoding/xml"
"fmt"
)
// Person 结构
type Person struct {
Name string `xml:"name,attr"`
Age int
}
// 入口
func main() {
ctj := Person{"chentingjun", 27}
if data, err := xml.MarshalIndent(ctj, "", " "); err != nil {
fmt.Println(err)
} else {
fmt.Println("serialization data =>\n", string(data))
}
}
标签:name nil image ack attr hal type int ali
原文地址:https://www.cnblogs.com/chentingjun/p/11793056.html