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
+36.6k Golang : How to split or chunking a file to smaller pieces?
+28.8k Get file path of temporary file in Go
+7.7k Javascript : Push notifications to browser with Push.js
+9.6k Golang : Convert(cast) string to int64
+6.7k Unix/Linux : How to get own IP address ?
+6k Facebook : How to force facebook to scrape latest URL link data?
+14.4k Golang : Get uploaded file name or access uploaded files
+12.6k Golang : HTTP response JSON encoded data
+5.6k Clean up Visual Studio For Mac installation failed disk full problem
+11.6k Golang : Format numbers to nearest thousands such as kilos millions billions and trillions
+9k Golang : HTTP Routing with Goji example
+7.3k CloudFlare : Another way to get visitor's real IP address