Standard library / encoding/xml

encoding/xml.HTMLAutoClose

List of HTML elements that may self-close in non-strict mode when assigned to Decoder.AutoClose. XML parsing is not a full HTML parser. Expected stdout: 'br\n'.

Formal Syntax & Structure

go syntaxgo
var HTMLAutoClose []string

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("<br>"))  d.Strict = false  d.AutoClose = xml.HTMLAutoClose  t, e := d.Token()  must(e)  fmt.Println(t.(xml.StartElement).Name.Local)}
Go Reference