2015-05-07 10:44:52 +00: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-10 23:02:17 +00:00
|
|
|
writeHeader(w, code, "application/xml; charset=utf-8")
|
2015-05-07 10:44:52 +00:00
|
|
|
return xml.NewEncoder(w).Encode(data)
|
|
|
|
}
|