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 <matt.har...@gmail.com> 写道: > > It works for me: https://play.golang.org/p/yCI68Zsg1E > <https://play.golang.org/p/yCI68Zsg1E> > On Tue, Jul 5, 2016 at 8:04 PM Hoping White <baihaop...@gmail.com > <mailto:baihaop...@gmail.com>> wrote: > > Hi, gophers > > > How do I unmarshal an xml as following: > > <resources> > <string name="about_part1”>data</string> > <string name="about_part2”>data</string> > </resources> > > 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"` > } > > > thanks. > > -- > 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 > <mailto:golang-nuts+unsubscr...@googlegroups.com>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- 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. For more options, visit https://groups.google.com/d/optout.