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

Keep getting error running example from doc #76

Closed
Heucles opened this issue Dec 1, 2017 · 4 comments
Closed

Keep getting error running example from doc #76

Heucles opened this issue Dec 1, 2017 · 4 comments
Labels

Comments

@Heucles
Copy link

Heucles commented Dec 1, 2017

Used xsd:

<?xml version="1.0" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="dog" type="xs:string" />
</xs:schema>

code:

let xsd2json = require('xsd2json');
let filename = '${__dirname}/schema.xsd';

// use as function
xsd2json(filename, (err, schemaObject) => {
    console.log(err);
    console.log(JSON.stringify(schemaObject));
});

Error message:

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at /home/heucles/dev/c4-omnigateway/app/node_modules/xsd2json/index.js:55:25
    at ConcatStream.<anonymous> (/home/heucles/dev/c4-omnigateway/app/node_modules/concat-stream/index.js:36:43)
    at emitNone (events.js:110:20)
    at ConcatStream.emit (events.js:207:7)
    at finishMaybe (/home/heucles/dev/c4-omnigateway/app/node_modules/readable-stream/lib/_stream_writable.js:607:14)
    at endWritable (/home/heucles/dev/c4-omnigateway/app/node_modules/readable-stream/lib/_stream_writable.js:615:3)
    at ConcatStream.Writable.end (/home/heucles/dev/c4-omnigateway/app/node_modules/readable-stream/lib/_stream_writable.js:571:41)
    at Socket.onend (_stream_readable.js:598:10)
    at Object.onceWrapper (events.js:314:30)
undefined
<Buffer 5b 46 41 54 41 4c 20 45 52 52 4f 52 3a 0a 09 43 6f 75 6c 64 20 6e 6f 74 20 6f 70 65 6e 20 72 65 73 6f 75 72 63 65 20 64 61 74 61 62 61 73 65 20 22 2f ... >
@fnogatz
Copy link
Owner

fnogatz commented Dec 3, 2017

I just updated the Markdown formatting of your message and will have a look at the reported bug soon.

@fnogatz
Copy link
Owner

fnogatz commented Dec 3, 2017

For me this works as expected. I get the following result:

{"type":"string"}

What versions of node, npm and SWI-Prolog are you using? Please provide the output of npm version and swipl --version.

@Heucles
Copy link
Author

Heucles commented Dec 4, 2017

npm -version
5.5.1

node -v
v8.4.0

swipl --version
SWI-Prolog version 7.2.3 for x86_64-linux

Also I think it is worth mentioning that my node was installed using NVM and aldo I didn´t installed xsd2json globally, only locally on the project.

@fnogatz
Copy link
Owner

fnogatz commented Dec 4, 2017

Ah, this is due to a known bug in SWI-Prolog 7.2.x, as documented in the readme file. Please upgrade your installation of SWI-Prolog, either with your package manager or using the SWI-Prolog version manager swivm.

I will close this issue. If the error occurs for a newer version of SWI-Prolog, too, please open a new issue.

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

No branches or pull requests

2 participants