Marshal arbitrary XML attributes in an element in Go?

I need to marshal in extra attributes on an element at runtime. I've tried this:\[code\]type Meh struct { XMLName xml.Name Attrs []xml.Attr}Meh{ Attrs: []xml.Attr{ xml.Attr{xml.Name{Local: "hi"}, "there"}, }, }\[/code\]But the fields are treated as new elements:\[code\]<Meh><Attrs><Name></Name><Value>there</Value></Attrs></Meh>\[/code\]If I add the tag \[code\]xml:",attr"\[/code\] to the \[code\]Attr\[/code\] field, it expects a \[code\][]byte\[/code\] or \[code\]string\[/code\] specifying the contents of a single attribute.How do I specify attributes at runtime? How do I annotate the type to provide field(s) for this?
 
Back
Top