index.go
func MarshalIndex(index *Index) (indexXML []byte, err error) {
	if len(index.Sitemaps) > MaxSitemaps {
		err = ErrExceededMaxSitemaps
		return
	}
	index.XMLNS = xmlns
	indexXML = []byte(preamble)
	var smiXML []byte
	smiXML, err = xml.Marshal(index)
	if err == nil {
		indexXML = append(indexXML, smiXML...)
	}
	if len(indexXML) > MaxFileSize {
		err = ErrExceededMaxFileSize
	}
	return
}
func MarshalIndex(index *Index) (indexXML []byte, err error) {
	if len(index.Sitemaps) > MaxSitemaps {
		err = ErrExceededMaxSitemaps
		return
	}
	index.XMLNS = xmlns
	indexXML = []byte(preamble)
	var smiXML []byte
	smiXML, err = xml.Marshal(index)
	if err == nil {
		indexXML = append(indexXML, smiXML...)
	}
	if len(indexXML) > MaxFileSize {
		err = ErrExceededMaxFileSize
	}
	return
}
// MarshalIndex serializes the sitemap index to XML, with the <sitemapindex>
// xmlns added and the XML preamble prepended.