1
I looked for some examples in the official documentation of golang and in some online tutorials but only find simple examples see:
<data>
    <person>
        <firstname>Nic</firstname>
        <lastname>Raboy</lastname>
        <address>
            <city>San Francisco</city>
            <state>CA</state>
        </address>
    </person>
    <person>
        <firstname>Maria</firstname>
        <lastname>Raboy</lastname>
    </person>
</data>
To read this structure xml I only need 2 struct being them: data and person, this example was taken from this site along with the resolution: thepolyglotdeveloper
Structs:
type Data struct {
    XMLName    xml.Name `xml:"data" json:"-"`
    PersonList []Person `xml:"person" json:"people"`
}
type Person struct {
    XMLName   xml.Name `xml:"person" json:"-"`
    Firstname string   `xml:"firstname" json:"firstname"`
    Lastname  string   `xml:"lastname" json:"lastname"`
    Address   *Address `xml:"address" json:"address,omitempty"`
}
type Address struct {
    City  string `xml:"city" json:"city,omitempty"`
    State string `xml:"state" json:"state,omitempty"`
}
My doubt is how I’m gonna do when a xml has more than one node as in the example below:
<SuccessResponse>
    <Head>
        <RequestId/>
        <RequestAction>XPTP</RequestAction>
        <ResponseType>XPTU</ResponseType>
        <Timestamp>TIMESTAMP</Timestamp>
    </Head>
    <Body>
        <Products>
            <Product>...</Product>
            <Product>...</Product>
        </Products>
    </Body>
</SuccessResponse>
I’m gonna need to create a struct for SuccessResponse and inside it I need to have struct with the name Body and within Body Products and so on?
what is the
XMLName xml.Name \xml:"person" json:"-"`na primeira linha dePerson`?– RFL