package gin import ( "encoding/xml" "reflect" "runtime" ) type H map[string]interface{} // Allows type H to be used with xml.Marshal func (h H) MarshalXML(e *xml.Encoder, start xml.StartElement) error { start.Name = xml.Name{ Space: "", Local: "map", } if err := e.EncodeToken(start); err != nil { return err } for key, value := range h { elem := xml.StartElement{ 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{Name: start.Name}); err != nil { return err } return nil } func filterFlags(content string) string { for i, a := range content { if a == ' ' || a == ';' { return content[:i] } } return content } func funcName(f interface{}) string { return runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name() }