Golang encoding/xml.Decoder.Token() function usage example

package encoding/xml

Token returns the next XML token in the input stream. At the end of the input stream, Token returns nil, io.EOF. See http://golang.org/pkg/encoding/xml/#Decoder.Token for detailed description

Golang encoding/xml.Decoder.Token() function usage example

 decoder := xml.NewDecoder(strings.NewReader(a.Answer))
 token, _ := decoder.Token()
 if token == nil {
  break
 }
 tokentype := token.(type)

Reference :

http://golang.org/pkg/encoding/xml/#Decoder.Token

Advertisement