Plant will be mapped to XML. Similarly to the JSON examples, field tags contain directives for the encoder and decoder. Here we use some special features of the XML package: the `XMLName` field name dictates the name of the XML element representing this struct; `id,attr` means that the `Id` field is
| 16 | // `id,attr` means that the `Id` field is an XML |
| 17 | // _attribute_ rather than a nested element. |
| 18 | type Plant struct { |
| 19 | XMLName xml.Name `xml:"plant"` |
| 20 | Id int `xml:"id,attr"` |
| 21 | Name string `xml:"name"` |
| 22 | Origin []string `xml:"origin"` |
| 23 | } |
| 24 | |
| 25 | func (p Plant) String() string { |
| 26 | return fmt.Sprintf("Plant id=%v, name=%v, origin=%v", |
nothing calls this directly
no outgoing calls
no test coverage detected