http.go
func HTTPRespondMarshalIndentXML(response interface{}, rootElement string, prefix, indent string, responseWriter http.ResponseWriter, request *http.Request) (err error) {
	NewHTTPCompressHandlerFromFunc(func(responseWriter http.ResponseWriter, request *http.Request) {
		var data []byte
		contentPrefix := prefix
		if rootElement != "" {
			contentPrefix += indent
		}
		if data, err = xml.MarshalIndent(response, contentPrefix, indent); err == nil {
			responseWriter.Header().Set("Content-Type", "application/xml")
			if rootElement == "" {
				_, err = fmt.Fprintf(responseWriter, "%s%s\n%s", prefix, xml.Header, data)
			} else {
				_, err = fmt.Fprintf(responseWriter, "%s%s%s<%s>\n%s\n%s</%s>", prefix, xml.Header, prefix, rootElement, data, prefix, rootElement)
			}
		}
	}).ServeHTTP(responseWriter, request)
	return err
}
func HTTPRespondMarshalIndentXML(response interface{}, rootElement string, prefix, indent string, responseWriter http.ResponseWriter, request *http.Request) (err error) {
	NewHTTPCompressHandlerFromFunc(func(responseWriter http.ResponseWriter, request *http.Request) {
		var data []byte
		contentPrefix := prefix
		if rootElement != "" {
			contentPrefix += indent
		}
		if data, err = xml.MarshalIndent(response, contentPrefix, indent); err == nil {
			responseWriter.Header().Set("Content-Type", "application/xml")
			if rootElement == "" {
				_, err = fmt.Fprintf(responseWriter, "%s%s\n%s", prefix, xml.Header, data)
			} else {
				_, err = fmt.Fprintf(responseWriter, "%s%s%s<%s>\n%s\n%s</%s>", prefix, xml.Header, prefix, rootElement, data, prefix, rootElement)
			}
		}
	}).ServeHTTP(responseWriter, request)
	return err
}
func HTTPRespondMarshalIndentXML ( response interface { } , rootElement string , prefix , indent string , responseWriter http . ResponseWriter , request * http . Request ) ( err error ) { NewHTTPCompressHandlerFromFunc ( func ( responseWriter http . ResponseWriter , request * http . Request ) { var data [ ] byte contentPrefix := prefix if rootElement != " " { contentPrefix += indent } if data , err = xml . MarshalIndent ( response , contentPrefix , indent ) ; err == nil { responseWriter . Header ( ) . Set ( " " , " " ) if rootElement == " " { _ , err = fmt . Fprintf ( responseWriter , " \n " , prefix , xml . Header , data ) } else { _ , err = fmt . Fprintf ( responseWriter , " \n \n " , prefix , xml . Header , prefix , rootElement , data , prefix , rootElement ) } } } ) . ServeHTTP ( responseWriter , request ) return err }
// HTTPRespondMarshalIndentXML marshals response as XML to responseWriter, sets Content-Type to application/xml
// and compresses the response if Content-Encoding from the request allows it.
// The XML will be marshalled indented according to xml.MarshalIndent.
// If rootElement is not empty, then an additional root element with this name will be wrapped around the content.
HTTPRespondMarshalIndentXML marshals response as XML to responseWriter sets Content - Type to application / xml and compresses the response if Content - Encoding from the request allows it . The XML will be marshalled indented according to xml . MarshalIndent . If rootElement is not empty then an additional root element with this name will be wrapped around the content .