package goxml_test import ( "testing" "git.pyer.club/kingecg/goxml" ) type Person struct { Name string `xml:"p:name"` Age int `xml:"p:age"` } type Employee struct { Person Salary int `xml:"p:salary"` } func TestUnmarshal(t *testing.T) { xml := ` John Doe 42 100000 ` e := Employee{} err := goxml.Unmarshal([]byte(xml), &e) if err != nil { t.Fatal(err) } } func TestMashal(t *testing.T) { e := Employee{ Person{ Name: "John", Age: 30, }, 50000, } b, _ := goxml.Marshal(e) t.Log(string(b)) }