Golang:另一个结构的XML属性

How can I add an XML element attribute from another struct?

For example: http://play.golang.org/p/E3K1KYnRH8

Embed the type with common attrs into your other types.

type AuthData struct {
    BuyerId  string `xml:"BuyerId,attr"`
    UserId   string `xml:"UserId,attr"`
    Language string `xml:"Language,attr"`
}

type MyRequest struct {
    XMLName  xml.Name `xml:"MyRequest"`
    AuthData // Embedding.
    Action   struct{} `xml:"Action"`
}

Playground: http://play.golang.org/p/u23HuwYgq2.