For my application, it does not matter if the string is human readable or not.
you can also add a function with that struct receiver.
// URL : Sitemap Xml
type URL struct {
Loc string `xml:"loc"`
}
// URLSET : Sitemap XML
type URLSET struct {
URLS []URL `xml:"url"`
}
// converting the struct to String format.
func (u URL) String() string {
return fmt.Sprintf(u.Loc)
}
So printing this struct field will return a string.
fmt.Println(urls.URLS)