Re: [go-nuts] encoding/xml Unmarshal problem

2016-07-05 Thread Hoping White
Thanks for the reply. After a careful compare, I found what I did wrong. Value string `xml:,chardata” `=> Value string `xml:”,chardata”`, missing a “ token. > 在 2016年7月6日,上午11:12,Matt Harden 写道: > > It works for me: https://play.golang.org/p/yCI68Zsg1E >

Re: [go-nuts] encoding/xml Unmarshal problem

2016-07-05 Thread Matt Harden
It works for me: https://play.golang.org/p/yCI68Zsg1E On Tue, Jul 5, 2016 at 8:04 PM Hoping White wrote: > > Hi, gophers > > > How do I unmarshal an xml as following: > > > data > > > I have tried with > > *type* Resources *struct* { > XMLName xml.Name `xml:"resources"` > Strings []String

[go-nuts] encoding/xml Unmarshal problem

2016-07-05 Thread Hoping White
Hi, gophers How do I unmarshal an xml as following: data I have tried with type Resources struct { XMLName xml.Name `xml:"resources"` Strings []String `xml:"string"` } type String struct { Name string `xml:"name,attr"` Value string `xml:,chardata"` }