xsd2json icon indicating copy to clipboard operation
xsd2json copied to clipboard

ERROR: -g user:main: Syntax error: Operator expected

Open joncorrin opened this issue 4 years ago • 7 comments

I keep getting the following error when trying to convert my xsd file: ERROR: -g user:main: Syntax error: Operator expected

Seems to be a Prolog issue. Any idea what could be wrong? The XSD appears to be valid.

https://xilo-s3.s3-us-west-2.amazonaws.com/ezauto.xsd

joncorrin avatar Apr 25 '20 04:04 joncorrin

Similar problem here: With one xsd it's working fine, with the other I get a json file with no content.

With --debug-info it shows: ERROR: -g user:main: false

With --trace it shows: ERROR: -g user:main: Undefined procedure: chr_leash/1 ERROR: In: ERROR: [11] chr_leash(none) ERROR: [10] main([space(remove),...|...],['C:\Users\taascru2\AppData\Roaming\npm\\node_modules\xsd2json\lib-pl\cli.exe','AccountRead.xsd']) at c:/users/taascru2/appdata/roaming/npm/node_modules/xsd2json/lib-pl/cli.pl:107 ERROR: [8] catch(user:main,error(existence_error(procedure,...),context(...,_30256)),'$toplevel':true) at c:/program files/swipl/boot/init.pl:386 ERROR: [7] catch_with_backtrace(user:main,error(existence_error(procedure,...),context(...,_30314)),'$toplevel':true) at c:/program files/swipl/boot/init.pl:436 ERROR: ERROR: Note: some frames are missing due to last-call optimization. ERROR: Re-run your program in debug mode (:- debug.) to get more detail.

Same happens if I trace or debug the xsd that normally works. With --debug-info or --trace I get the error messages and an empty json. After deleting the empty file and rerun the command without flags, it works again.

For the second xsd that never works I get no hint what could be wrong with it. It has a dependency to another xsd that has a dependency to a third xsd. Could this be the reason?

Thanks in advance for your help.

nachtigall-83 avatar Jun 25 '20 15:06 nachtigall-83

With --debug-info it shows: ERROR: -g user:main: false

Hm, we should first try to get --debug-info working. Have you installed xsd2json as a global module (npm install -g xsd2json), or as a dependency in your local package.json?

fnogatz avatar Jun 26 '20 08:06 fnogatz

I installed it as a global module.

nachtigall-83 avatar Jun 29 '20 06:06 nachtigall-83

What version of SWI-Prolog are you using? (simply call swipl --version)

fnogatz avatar Jun 29 '20 08:06 fnogatz

SWI-Prolog version 8.0.3 for x64-win64

nachtigall-83 avatar Jun 29 '20 08:06 nachtigall-83

I think the problem here is the Windows OS. Actually, I never tried xsd2json on a Windows machine, but I see several possibilities for issues here. As I don't have a Windows machine at hand, I unfortunately can't provide an ad-hoc solution.

@joncorrin, are you using a Windows machine, too?

fnogatz avatar Jun 29 '20 10:06 fnogatz

I finally managed to install it on my ancient Mac, but not as a global module. Running with debug-info gives me a json file with this content (but nothing in the terminal): #xsd2json 1.12.16 #SWI-Prolog SWI-Prolog version 7.6.4 for x86_64-darwin15.6.0 #npm 6.14.5 #node v12.18.1

Tracing option seems to work, it gives me a huge amount of output in the Terminal. I didn't have the time to check this, but last line is: ERROR: -g main: Domain error: 'chr_port' expected, found 'none'

This may give you a hint?

nachtigall-83 avatar Jul 06 '20 15:07 nachtigall-83