Standard library / encoding/xml

encoding/xml.HTMLEntity

Map of HTML entity names to text, optionally assigned to Decoder.Entity. Do not mutate the shared map. Expected stdout: '©\n'.

Formal Syntax & Structure

go syntaxgo
var HTMLEntity map[string]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("<a>&copy;</a>"))  d.Entity = xml.HTMLEntity  var s string  must(d.Decode(&s))  fmt.Println(s)}
Go Reference