fnogatz / xsd2json

Translate XML Schema into equivalent JSON Schema
MIT License
149 stars 28 forks source link

Unable to use either the cli or programatically on MacOS #87

Open TinoADev opened 6 years ago

TinoADev commented 6 years ago

I get the following error when I try to use xsd2json:

Could not open resource database "/usr/local/bin/xsd2json": Inappropriate ioctl for device]

I noticed that the /usr/local/bin/xsd2json is a symlink to .../lib-pl/cli.exe and also saw the commit that talked about windows compatibility. Could this be the issue?

fnogatz commented 6 years ago

The lib-pl/cli.exe is an SWI-Prolog saved state. For Linux, this is simply a file starting with the shebang #!/bin/sh:

> head -n5 cli.exe
#!/bin/sh
# SWI-Prolog saved state
exec ${SWIPL-/home/fnogatz/.swivm/versions/7.6.4/lib/swipl-7.6.4/bin/x86_64-linux/swipl} -x "$0" -- "$@"

<archive>

I would expect similar for MacOS. Could you provide the output for head -n5 cli.exe?

In the meantime, you can use xsd2json directly with SWI-Prolog by calling cli.pl:

> swipl -g main cli.pl -- --help
> swipl -g main cli.pl -- ../test/xsd/all_element2.xsd
TinoADev commented 6 years ago

Hey there, thx for the quick reply.

Here is the output: `#!/bin/sh \ # SWI-Prolog saved state \ exec ${SWIPL-/usr/local/Cellar/swi-prolog/7.6.4/libexec/lib/swipl-7.6.4/bin/x86_64-darwin16.7.0/swipl} -x "$0" -- "$@"\ \

` For my project I need to use xsd2json programatically, but thanks for the suggestion.
fnogatz commented 6 years ago

I have added a noExe: true option for the node.js module in version v1.11.7 in order to use the native Prolog interface instead of the pre-compiled cli.exe. You can find the documentation here, and an example here.

Nevertheless, using the Prolog interface instead of the pre-compiled cli.exe has performance issues. But since I have no access to a MacOS machine, I am not able to fix the original issue...