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