A symbol of comma in the xml definition


(cinematik) #1

What does the symbol , actually do in the following definition?

Data string xml:",chardata"

xml itself
<root><source:encoding><![CDATA[Hello]]></source:encoding></root>


(Johan Dahl) #2

https://golang.org/pkg/encoding/xml/#Unmarshal

If the XML element contains character data, that data is
accumulated in the first struct field that has tag “,chardata”.
The struct field may have type []byte or string.
If there is no such field, the character data is discarded.