Say that I've got a Go struct defined as follows:
type MyType struct {
FieldA string
FieldB string
FIeldC string
}
and XML that corresponds to it that looks like this:
<obj>
<fieldA value="apple"/>
<fieldB value="banana"/>
</obj>
where FieldA and FieldB are mandatory, and FieldC is optional. How do I specify the struct tags so as to get the field's value from the "value" attribute? This:
FieldA string `xml:"fieldA>value,attr"`
FieldB string `xml:"fieldB>value,attr"`
FieldC string `xml:"fieldC>value,attr,omitempty"`
generates "xml: fieldA>value chain not valid with attr flag" and this:
FieldA string `xml:"fieldA"`
FieldB string `xml:"fieldB"`
FieldC string `xml:"fieldC,omitempty"`
doesn't generate an error, but doesn't find the values of the fields.