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 :
Advertisement
Something interesting
Tutorials
+11.8k How to tell if a binary(executable) file or web application is built with Golang?
+20k Golang : Measure http.Get() execution time
+10.1k Golang : Channels and buffered channels examples
+14.2k Golang : Check if a file exist or not
+10.6k Golang : Generate 403 Forbidden to protect a page or prevent indexing by search engine
+11.4k Golang : How to flush a channel before the end of program?
+5.8k Linux : Disable and enable IPv4 forwarding
+4.8k JavaScript: Add marker function on Google Map
+13.7k Golang : reCAPTCHA example
+6.8k Golang : Experimental emojis or emoticons icons programming language