Open DominikTrenz opened 7 years ago
The xsd was missing the "targetNamespace". Maybe it should work without?
I can confirm that I saw the same stack when trying to process an xsd that has no targetNamespace.
In my case I was using: http://www.musicxml.com/xsd/musicxml.xsd
Adding a targetNamespace fixes the issue, allowing a typed document to be created.
Can cxsd be changed to set a default targetNamespace if none is found?
http://download.hl7.de/ukf/ukf201.xsd
Errorlog:
TypeError: Cannot read property 'getScope' of undefined at Schema.init (C:\somepath\node_modules\cxsd\dist\xsd\types\Schema.js:32:49) at Parser.startElement (C:\somepath\node_modules\cxsd\dist\xsd\Parser.js:72:21) at Parser.<anonymous> (C:\somepath\node_modules\cxsd\dist\xsd\Parser.js:112:31) at emitTwo (events.js:106:13) at Parser.emit (events.js:191:7) at Parser.parse (C:\somepath\node_modules\cxsd\node_modules\node-expat\lib\node-expat.js:23:22) at ReadStream.<anonymous> (C:\somepath\node_modules\cxsd\dist\xsd\Parser.js:147:17) at emitOne (events.js:96:13) at ReadStream.emit (events.js:188:7) at ReadStream.Readable.read (_stream_readable.js:381:10) at flow (_stream_readable.js:761:34) at resume_ (_stream_readable.js:743:3) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9) Stack: TypeError: Cannot read property 'getScope' of undefined at Schema.init (C:\somepath\node_modules\cxsd\dist\xsd\types\Schema.js:32:49) at Parser.startElement (C:\somepath\node_modules\cxsd\dist\xsd\Parser.js:72:21) at Parser.<anonymous> (C:\somepath\node_modules\cxsd\dist\xsd\Parser.js:112:31) at emitTwo (events.js:106:13) at Parser.emit (events.js:191:7) at Parser.parse (C:\somepath\node_modules\cxsd\node_modules\node-expat\lib\node-expat.js:23:22) at ReadStream.<anonymous> (C:\somepath\node_modules\cxsd\dist\xsd\Parser.js:147:17) at emitOne (events.js:96:13) at ReadStream.emit (events.js:188:7) at ReadStream.Readable.read (_stream_readable.js:381:10) at flow (_stream_readable.js:761:34) at resume_ (_stream_readable.js:743:3) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9) TypeError: Cannot read property 'id' of undefined at ContextBase.copyNamespace (C:\somepath\node_modules\cxml\dist\xml\ContextBase.js:33:49) at Object.exportNamespace (C:\somepath\node_modules\cxsd\dist\xsd\Exporter.js:142:32) at C:\somepath\node_modules\cxsd\dist\cli.js:40:35 at tryCatcher (C:\somepath\node_modules\bluebird\js\release\util.js:16:23) at Promise._settlePromiseFromHandler (C:\somepath\node_modules\bluebird\js\release\promise.js:510:31) at Promise._settlePromise (C:\somepath\node_modules\bluebird\js\release\promise.js:567:18) at Promise._settlePromise0 (C:\somepath\node_modules\bluebird\js\release\promise.js:612:10) at Promise._settlePromises (C:\somepath\node_modules\bluebird\js\release\promise.js:691:18) at Async._drainQueue (C:\somepath\node_modules\bluebird\js\release\async.js:133:16) at Async._drainQueues (C:\somepath\node_modules\bluebird\js\release\async.js:143:10) at Immediate.Async.drainQueues (C:\somepath\node_modules\bluebird\js\release\async.js:17:14) at runCallback (timers.js:637:20) at tryOnImmediate (timers.js:610:5) at processImmediate [as _immediateCallback] (timers.js:582:5) Stack: TypeError: Cannot read property 'id' of undefined at ContextBase.copyNamespace (C:\somepath\node_modules\cxml\dist\xml\ContextBase.js:33:49) at Object.exportNamespace (C:\somepath\node_modules\cxsd\dist\xsd\Exporter.js:142:32) at C:\somepath\node_modules\cxsd\dist\cli.js:40:35 at tryCatcher (C:\somepath\node_modules\bluebird\js\release\util.js:16:23) at Promise._settlePromiseFromHandler (C:\somepath\node_modules\bluebird\js\release\promise.js:510:31) at Promise._settlePromise (C:\somepath\node_modules\bluebird\js\release\promise.js:567:18) at Promise._settlePromise0 (C:\somepath\node_modules\bluebird\js\release\promise.js:612:10) at Promise._settlePromises (C:\somepath\node_modules\bluebird\js\release\promise.js:691:18) at Async._drainQueue (C:\somepath\node_modules\bluebird\js\release\async.js:133:16) at Async._drainQueues (C:\somepath\node_modules\bluebird\js\release\async.js:143:10) at Immediate.Async.drainQueues (C:\somepath\node_modules\bluebird\js\release\async.js:17:14) at runCallback (timers.js:637:20) at tryOnImmediate (timers.js:610:5) at processImmediate [as _immediateCallback] (timers.js:582:5)