anyxml.Xml does not handle nil attribute values correctly
Closed this issue · 2 comments
dechamps commented
Steps to reproduce:
package main
import (
"fmt"
"github.com/clbanning/anyxml"
)
func main() {
xmlout, err := anyxml.Xml(map[string]interface{}{"toplevel": nil}, "root")
if err != nil {
return
}
fmt.Println(string(xmlout))
}
Expected result:
<root><toplevel /></root>
Actual result:
<root><toplevel</root>
Which is not valid XML.
This is causing downstream issue chrismalek/jsontoxml-cli#1.
clbanning commented
Don't know what you weren't using clbanning/j2x or clbanning/mxj/j2x instead of chrismalek/jsontoxml
dechamps commented
Well that would be a question for @chrismalek, jsontoxml-cli's author.
That said, I found it was very easy to migrate jsontoxml-cli to mxj, so I sent chrismalek/jsontoxml-cli#2 to do just that.
Thanks for the help. It would probably be a good idea to update your repo to reflect the fact that it should not be used, and direct users to clbanning/mxj.