generate Go structs from XSD

user2912044 picture user2912044 · Dec 22, 2013 · Viewed 9.3k times · Source

recently I am planing to do a project using Go. My problem is : given a XSD file, how to auto-generate structs in Go to represent the XML elements. It is similar to using 'xjc' to generate java classes from XSD. So is there any tools or packages to do this in Go?

Thanks in advance.

Answer

Eve Freeman picture Eve Freeman · Dec 22, 2013

Looks like it might need some TLC for 1.2 support, but there's: https://github.com/metaleap/go-xsd

Which has a set of example packages that have been generated for different common XML formats: https://github.com/metaleap/go-xsd-pkg