Standard library / encoding/xml

encoding/xml.Comment

Represents XML comment text without the delimiters. Expected stdout: 'note\n'.

Formal Syntax & Structure

go syntaxgo
type Comment []byte

Working Example

Example Snippetgo
package main
import (  "encoding/xml"  "fmt"  "strings")
func must(e error) {  if e != nil {    panic(e)  }}
func main() {  d := xml.NewDecoder(strings.NewReader("<!--note-->"))  t, e := d.Token()  must(e)  fmt.Println(string(t.(xml.Comment)))}
Go Reference