Golang encoding/xml.CharData type examples

package encoding/xml

A CharData represents XML character data (raw text), in which XML escape sequences have been replaced by the characters they represent.

Example 1 :

 var rawTokens = []Token{
 CharData("\n"),
 ProcInst{"xml", []byte(`version="1.0" encoding="UTF-8"`)},
 CharData("\n"),
 Directive(`DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"`),
 CharData("\n"),
 }

Example 2 :

 switch t := token.(type) {
 case xml.CharData:
 raw := string(t)
 typedef.CDefinition += raw
 if readingName {
 typedef.Name = raw
 }
 ...

Reference :

http://golang.org/pkg/encoding/xml/#CharData

Advertisement