Very nice, `xml:",any"` was doing the trick. I've condensed the function
and here's the (currently) final
result: https://play.golang.org/p/G1eGw5gtk7C
func id3(axl []byte) string {
type Return struct {
Response struct {
Return string `xml:"return"`
} `xml:",any"`
}
var ret Return
err := xml.Unm
You don't have to use an xml.Decoder. You may be able to use the
`xml:",any"` tag for this case.
type Response struct {
XMLName xml.Name
Return string `xml:"return"`
}
type Outer struct {
XMLName struct{} `xml:"outer"`
Responses []Response `xml:",any"`
}
https://play.golang.org/p/j4w4-1uuYa
Your function appears to return error text, but it will be much more clear
what's going on when reading the code if you encode your intent in the return
type and return an error instead of a string (which gives me no information
about what that string is supposed to represent: is it an error? is