From f8d85c1b4de8a6987446e984885fc111ae4a001b Mon Sep 17 00:00:00 2001 From: Manu Mtz-Almeida Date: Sun, 6 Jul 2014 18:25:17 +0200 Subject: [PATCH] Fixes MarshalXML() and renames initial "H" tag to "map". --- gin.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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