I have two structs in order to marshal into XML
//Accounts ...
type Accounts struct {
XMLName xml.Name `xml:"account"`
AccNumber string `xml:"iban"`
}
//Accounts ...
type AccountsList struct {
XMLName xml.Name `xml:"response"`
ResultCode string `xml:"resultCode"`
Accounts []Accounts `xml:"result"`
}
I'm getting next xml structure:
<response>
<resultCode>...</resultCode>
<account>
<iban>...</iban>
</account>
<account>
<iban>...</iban>
</account>
</response>
But I need also <result>
tag, so I need next xml:
<response>
<resultCode>...</resultCode>
<result>
<account>
<iban>...</iban>
</account>
<account>
<iban>...</iban>
</account>
<result>
</response>
Why Golang XML marshaller is ignoring this thing xml:"result"
in AccountsList
structure?
Is it possible to get result I want without using third structure?