go - In golang how do I encode an xml parameter containing a space? -
i have xml api construct need use (this construct not defined me , cannot change it): <path><farmer id="me7"/></path> in go have: type path struct { xmlname xml.name `xml:"path"` farmerid string `xml:"farmer id,attr"` } pmux := &path{farmerid: "me7"} however go encodes pmux , prints this: <path xmlns:farmer="farmer" farmer:id="me7" </path> what want this: <path><farmer id="me7"/> </path> how can achieve this? thx the xml invalid, if need come out that, use regular expression fix afterward. here example. i assuming want open tag valid <path farmer id="me7"></path> , instead of not having open tag valid posted <path farmer id="me7" </path> , either way doable regex. btw, question inconsistent want. start wanting <path><farmer id="me7"></path> , @eugenioy 's an...