metaleap / go-xsd

[stable since 2013] a lib for loading XML Schema Definition (XSD) files ➜ plus, a tool `makepkg` to code-generate from any *.xsd your Go package with all needed `struct`s to readily `xml.Unmarshal()` documents into, based on the XSD's schema definitions. NOT REALLY MAINTAINED FOR YEARS NOW: try the forks if running into issues.
http://www.reddit.com/r/golang/comments/12g6sl/is_there_a_tool_that_generates_go_source_code_for/
MIT License
216 stars 66 forks source link

The order of elements in a go struct varies from the order in xsd #23

Closed akankaria closed 7 years ago

akankaria commented 8 years ago

Hi,

First of all this is a wonderful package which reduced my task significantly. So kudos for that.

Secondly, I am trying to use the go-xsd package to convert a xsd file to go schema. As my xsd uses xs:Sequence tag, I want the xsd order to be maintained in go struct. The order of attributes of the go structs which are generated differ from the order specified in xsd. Moreover, the order of attributes of go struct is different every time.

This results in an incorrect order of attribute tags in xml request while serialization of go struct.

Please let me know if you already have a functionality to maintain the xsd order (by using some flag) or you plan to include this.

Thanks, Ashish

zevdg commented 8 years ago

This looks like a duplicate of issue #7 ?