diff --git a/gin.go b/gin.go index cc37508..33459cb 100644 --- a/gin.go +++ b/gin.go @@ -83,6 +83,7 @@ var ( // 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"} if err := e.EncodeToken(start); err != nil { return err } @@ -91,11 +92,11 @@ func (h H) MarshalXML(e *xml.Encoder, start xml.StartElement) error { xml.Name{"", key}, []xml.Attr{}, } - if err = e.EncodeElement(value, elem); err != nil { + 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{start.Name}); err != nil { return err } return nil