Standard library / encoding/xml

encoding/xml.Decoder

Streams XML tokens or decodes Go values. Strict defaults to true; Entity, AutoClose and CharsetReader can customize parsing. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
type Decoder struct {  Strict bool
  AutoClose []string
  Entity map[string]string
  CharsetReader func(charset string, input io.Reader) (io.Reader, error)
  DefaultSpace string
  // Has unexported fields.}

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("<a/>")); fmt.Println(d.Strict) }
Go Reference