2

The package encoding/xml provides a convenient way to parse or generate .xml files. However, the file generated are in format

<xxx attr1="aaa" attr2="bbb"></xxx>

even if there is no content in the element. Some server do not accept this kind of format.

So how to get the .xml file looks like

<xxx attr1="aaa" attr2="bbb" />
Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
zhi lin
  • 21
  • 1
  • 3
  • Not possible currently AFAICT. You might be able to do this in [Go 1.13, or 1.14](https://github.com/golang/go/issues/21399)? For now you can use this [workaround](https://play.golang.org/p/W5cQkqS0h_), taken from this [discussion](https://groups.google.com/forum/#!topic/golang-nuts/guG6iOCRu08) – mkopriva Aug 15 '19 at 06:28

0 Answers0