Context.XML(v, ...opts)
is the method which sends XML responses to the client. It accepts the value and optional settings for rendering. The XML
options structure looks like this:IfIndent
field is empty and the application runs without optimizations, theIndent
field will be automatically set to2 spaces
.
map
or iris.Map
on context.XML
because the value should complete the xml.Marshaler interface. Iris has the iris.XMLMap
which converts a map
(or iris.Map
) to xml Marshaler. That helper function accepts the root level name and a map. Example: