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
217 stars 66 forks source link

Change for support of declared but not used types/xsd.Time/and data type conversion #4

Closed lobatt closed 11 years ago

lobatt commented 11 years ago

Hi, While using this great lib tool xsd-makepkg, I met some issues while generating go code from http://www.cablelabs.com/projects/metadata/specifications/xml_schemas/MD-SP-TITLE-I02.xsd It imports another schema: http://www.cablelabs.com/projects/metadata/specifications/xml_schemas/MD-SP-CORE-I02.xsd

The imported schema defined some types to be used in other schemas, while generating code package for it, the xsd-makepkg added those types but never rendered them into output.

I tweaked a little bit and found a fix that worked for me as the commit https://github.com/lobatt/go-xsd/commit/788d3fa0cdabb079ca0b4ef18395a2ee5ad77b1b shows.

The other 2 commits are for

Which are both pretty simple but solved some problems so I included in this pull request.

It would be great if you can review the change and point out if I misunderstood anything. Thanks!