Perhaps you can adapt this to your needs. https://github.com/glycerine/xml2csv
by taking just the xml parsing part, and then doing what you want with the tree of tags. On Tuesday, November 28, 2023 at 3:00:18 PM UTC Jérôme LAFORGE wrote: > Hello, > The playground: https://go.dev/play/p/EQTHwGlKQDt > > I have this xml > data := []byte(`<xml1> > <xml2>hello</xml2> > <xml3><xml4>foobar</xml4></xml3> > </xml1>`) > > That, I want to unmarhsall into xmlBody struct: > type ( > xml3 struct { > Data string `xml:",innerxml"` > } > > xmlBody struct { > XML2 string `xml:"xml2"` > XML3 xml3 `xml:"xml3"` > } > ) > > Unfortunately, I am not able to get <xml3><xml4>foobar</xml4></xml3> as > string in x.XML3.Data. > > Thanks in advance for your help. > > > > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/ba084e07-fcec-4d2e-af7e-e93c3878e07bn%40googlegroups.com.