mirror of https://github.com/gin-gonic/gin.git
Fix XML Marshal to work with gin.H
This commit is contained in:
parent
5eb0e10a78
commit
3c2da97919
11
gin.go
11
gin.go
|
@ -62,6 +62,17 @@ type (
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Allows type H to be used with xml.Marshal
|
||||||
|
func (h H) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
|
||||||
|
e.EncodeToken(start)
|
||||||
|
for key, value := range h {
|
||||||
|
elem := xml.StartElement{Name: xml.Name{Local: key}}
|
||||||
|
e.EncodeElement(value, elem)
|
||||||
|
}
|
||||||
|
e.EncodeToken(xml.EndElement{start.Name})
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (a ErrorMsgs) String() string {
|
func (a ErrorMsgs) String() string {
|
||||||
var buffer bytes.Buffer
|
var buffer bytes.Buffer
|
||||||
for i, msg := range a {
|
for i, msg := range a {
|
||||||
|
|
Loading…
Reference in New Issue