Using keyed initialization to fix app-engine integration

This commit is contained in:
Manu Mtz-Almeida 2014-07-13 16:53:46 +02:00
parent f63a354b40
commit 94bc35bb2d

11
gin.go
View File

@ -80,20 +80,23 @@ type (
// Allows type H to be used with xml.Marshal
func (h H) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
start.Name = xml.Name{"", "map"}
start.Name = xml.Name{
Space: "",
Local: "map",
}
if err := e.EncodeToken(start); err != nil {
return err
}
for key, value := range h {
elem := xml.StartElement{
xml.Name{"", key},
[]xml.Attr{},
Name: xml.Name{Space: "", Local: key},
Attr: []xml.Attr{},
}
if err := e.EncodeElement(value, elem); err != nil {
return err
}
}
if err := e.EncodeToken(xml.EndElement{start.Name}); err != nil {
if err := e.EncodeToken(xml.EndElement{Name: start.Name}); err != nil {
return err
}
return nil