Help with xml to struct


(Miha) #1

Hi

I am using thick pakage for soap: https://github.com/tiaguinho/gosoap

OK, I need to transform this xml to struct: https://pastebin.com/gMGmWejJ

I was trying to do it like this but with no luck:

type PollResponse struct {
	XMLName xml.Name `xml:"return"`
	User    User     `xml:"user"`
}

type User struct {
	Value []Value `xml:"user"`
}

type Value struct {
	active bool `xml:"active"`
}

tnx
miha


(Taavi Kivisik) #2

I recently tried to distill the essential into this Q&A: https://stackoverflow.com/questions/53305826/how-to-unmarshal-simple-xml-with-multiple-items-in-go/53305827#53305827 . Maybe that helps.

I also notice your active field of the Value struct starts with a lower case letter.


(Miha) #3

hello

thank you.

brmiha