package test import ( "testing" ) type Sub struct { A string `xml:"a"` } type Test struct { A int32 `json:"a" xml:"a"` B bool `json:"b" xml:"b"` C string `json:"c" xml:"c"` D Sub `xml:"sub"` } func TestXml(t *testing.T) { // x := map[string]interface{}{} // x["map"] = 1 // x["ss"] = 2 // test := Test{A: 1, B: false, C: "hell", D: Sub{A: "aa"}} // bytes, e := xml.Marshal(&test) // if nil != e { // t.Error(e.Error()) // } // bytes, e = xml.Marshal(&x) // if nil != e { // t.Error(e.Error()) // } }