Standard library / encoding/xml

encoding/xml.Directive

Represents a declaration token such as a DOCTYPE, excluding its delimiters. It does not cause external DTD retrieval. Expected stdout: 'DOCTYPE a\n'.

Formal Syntax & Structure

go syntaxgo
type Directive []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("<!DOCTYPE a><a/>"))  t, e := d.Token()  must(e)  fmt.Println(string(t.(xml.Directive)))}
Go Reference