Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to parse following xsd #12

Open
DominikTrenz opened this issue Feb 28, 2017 · 2 comments
Open

failed to parse following xsd #12

DominikTrenz opened this issue Feb 28, 2017 · 2 comments

Comments

@DominikTrenz
Copy link

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)

@DominikTrenz
Copy link
Author

The xsd was missing the "targetNamespace". Maybe it should work without?

@owennewo
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants