Golang encoding/xml.Directive type example

package encoding/xml

A Directive represents an XML directive of the form . The bytes do not include the <! and > markers.

Golang encoding/xml.Directive type usage example

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

 case xml.Directive:
  fmt.Printf("<!")
  fmt.Printf(token)
  fmt.Printf(">")

Reference :

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

Advertisement