MCPcopy Create free account
hub / github.com/mmcgrana/gobyexample / Plant

Struct Plant

examples/xml/xml.go:18–23  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

16// `id,attr` means that the `Id` field is an XML
17// _attribute_ rather than a nested element.
18type 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
25func (p Plant) String() string {
26 return fmt.Sprintf("Plant id=%v, name=%v, origin=%v",

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected