Standard library / encoding/xml

encoding/xml.UnmarshalError.Error()

Returns the textual message stored by an UnmarshalError. Expected stdout: 'invalid element\n'.

Formal Syntax & Structure

go syntaxgo
func (e UnmarshalError) Error() string

Return Value

string

Text representation.

Working Example

Example Snippetgo
package main
import (  "encoding/xml"  "fmt")
func must(e error) {  if e != nil {    panic(e)  }}
func main() { fmt.Println(xml.UnmarshalError("invalid element").Error()) }
Go Reference