Situation:
I have this XML structure:
<group id="26659127">
<member ref="292403538"/>
<member ref="298884289"/>
<member ref="261728686"/>
<info k="name" v="omega"/>
<info k="rank" v="16"/>
</group>
I need to convert this XML into this struct:
{
Id: "26659127",
Members: ["26659127", "298884289", "261728686"],
Info: [
{
Key: "name",
Value: "omega"
},
{
Key: "rank",
Value: "16"
}
]
}
Problem:
I created a struct for parsing XML already:
type Group struct {
Id string `xml:"id,attr"`
Members []string `xml:" "`
Info []Info `xml:"info"`
}
type Info struct {
Key string `xml:"k,attr"`
Value string `xml:"v,attr"`
}
But, as you can see I haven't defined an expression for Members
yet. Actually, I tried putting xml:"member,ref,attr"
and xml:"member:ref,attr"
in here, but it didn't work.
Question:
Is there a possibility to solve this issue? If yes, what expression I should use?