sitemap.go
func Marshal(urlset *URLSet) (sitemapXML []byte, err error) {
	if len(urlset.URLs) > MaxURLs {
		err = ErrExceededMaxURLs
		return
	}
	urlset.XMLNS = xmlns
	sitemapXML = []byte(preamble)
	var urlsetXML []byte
	urlsetXML, err = xml.Marshal(urlset)
	if err == nil {
		sitemapXML = append(sitemapXML, urlsetXML...)
	}
	if len(sitemapXML) > MaxFileSize {
		err = ErrExceededMaxFileSize
	}
	return
}
func Marshal(urlset *URLSet) (sitemapXML []byte, err error) {
	if len(urlset.URLs) > MaxURLs {
		err = ErrExceededMaxURLs
		return
	}
	urlset.XMLNS = xmlns
	sitemapXML = []byte(preamble)
	var urlsetXML []byte
	urlsetXML, err = xml.Marshal(urlset)
	if err == nil {
		sitemapXML = append(sitemapXML, urlsetXML...)
	}
	if len(sitemapXML) > MaxFileSize {
		err = ErrExceededMaxFileSize
	}
	return
}
// Marshal serializes the sitemap URLSet to XML, with the <urlset> xmlns added
// and the XML preamble prepended.