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

Parsing XSD Error: too many open files #9

Closed fwachs closed 7 years ago

fwachs commented 10 years ago

I'm trying to generate files like this:

Fefes-mcp:xsd-makepkg fefewachs$ go run main.go -uri=https://s3.amazonaws.com/cda-xsd/CDA.xsd -local=true 2014/09/10 11:47:18 LOAD: https://s3.amazonaws.com/cda-xsd/CDA.xsd 2014/09/10 11:47:20 ERROR: open /Users/fefewachs/gocode/src/github.com/metaleap/go-xsd-pkg/s3.amazonaws.com/cda-xsd/processable/coreschemas/voc.xsd: too many open files

Is there something I'm doing wrong?

alimoeeny commented 10 years ago

If it helps, the problem is caused by a circular reference. One file includes the other one and the other one eventually includes the first one. Circular includes.

lobatt commented 9 years ago

Yes, I have met the same issue, but it give me a stack overflow

untime: goroutine stack exceeds 1000000000-byte limit
fatal error: stack overflow

runtime stack:
runtime.throw(0x607aa0)
/usr/local/Cellar/go/1.2/libexec/src/pkg/runtime/panic.c:464 +0x69
runtime.newstack()
/usr/local/Cellar/go/1.2/libexec/src/pkg/runtime/stack.c:295 +0x3bc
runtime.morestack()
/usr/local/Cellar/go/1.2/libexec/src/pkg/runtime/asm_amd64.s:225 +0x61

I am working on a fix and will send pull request when done.

lobatt commented 9 years ago

OK, I believe my fix just fixed my problem, not #9. Testing using the schema given...

alimoeeny commented 9 years ago

Thanks @lobatt greatly appreciate it.

lobatt commented 9 years ago

New fix committed and pull request sent.

However, there is an issue with https://s3.amazonaws.com/cda-xsd/NarrativeBlock.xsd that its claim to use encoding 'ASCII' which is not supported by default.

If you try modify the local copy to

<?xml version="1.0" encoding="utf-8"?>

and run

$ go run main.go -uri=https://s3.amazonaws.com/cda-xsd/CDA.xsd -local=true

It would work.

the xml decode charset issue is another issue though.

alimoeeny commented 9 years ago

Thank you very much @lobatt

fwachs commented 9 years ago

Excellent work @lobatt ! Thanks a lot for your cooperation on this matter.