gin-gonic/gin — pull request #40 by chad-russell (2014-07-05 02:34:02+00:00)
Title: Fix "encoding/xml cannot marshal maps"

This is an implementation of the MarshalXML interface for the type gin.H. It fixes [bug #12](https://github.com/gin-gonic/gin/issues/12). The implementation is very simple, and probably doesn't take into account all possible edge cases. Even so, it will correctly parse all basic types as well as structs and maps, even with nested components. For example, the following works:

r.GET("/someXML", func(c *gin.Context) {
c.XML(200, gin.H{
"int": 42,
"string": "hello, world",
"slice": []int{1, 2, 3},
"map": gin.H{"nested": "still works"},
})
})

It will produce the output:

```

hello, world
1
2
3

still works

42

```