2015-05-07 13:44:52 +03:00
|
|
|
package render
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/xml"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
type xmlRender struct{}
|
|
|
|
|
|
|
|
func (_ xmlRender) Render(w http.ResponseWriter, code int, data ...interface{}) error {
|
|
|
|
return WriteXML(w, code, data[0])
|
|
|
|
}
|
|
|
|
|
|
|
|
func WriteXML(w http.ResponseWriter, code int, data interface{}) error {
|
2015-05-11 02:02:17 +03:00
|
|
|
writeHeader(w, code, "application/xml; charset=utf-8")
|
2015-05-07 13:44:52 +03:00
|
|
|
return xml.NewEncoder(w).Encode(data)
|
|
|
|
}
|