Standard library / encoding/xml

encoding/xml.Header

Optional XML declaration with UTF-8 encoding and a trailing newline. Marshal does not insert it automatically. Expected stdout: '<?xml version="1.0" encoding="UTF-8"?>\n'.

Formal Syntax & Structure

go syntaxgo
const Header = `<?xml version="1.0" encoding="UTF-8"?>` + "\n"

Working Example

Example Snippetgo
package main
import (  "encoding/xml"  "fmt")
func must(e error) {  if e != nil {    panic(e)  }}
func main() { fmt.Print(xml.Header) }
Go Reference