fnogatz / xsd2json

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

ddex standard convertion not working #95

Open joneldiablo opened 5 years ago

joneldiablo commented 5 years ago

I try to convert with this code:

var xsd2json = require('xsd2json');
var filename = '../examples/release-notification.xsd';

// use as function
xsd2json(filename, {'debug-info':true},function(err, schemaObject) {
  if(err) throw err;
  console.log(JSON.stringify(schemaObject, null, 2));
});

the xml schema from here http://service.ddex.net/xml/ern/37/release-notification.xsd but in the console just have this error ERROR: -g user:main: false

what it means?

if I remove this , {'debug-info':true} from the function, the execution hangs

fnogatz commented 5 years ago

Thank you for reporting this. First of all, it is a good idea to try the native Prolog interface as described here. It gives the following:

> swipl -g main cli.pl -- /home/fnogatz/tmp/release-notification.xsd
ERROR: -g main: open/4: source_sink `'/home/fnogatz/tmp/http://ddex.net/xml/avs/avs_20161006.xsd'' does not exist (No such file or directory)

As of now, xsd2json does not support remote locations as it can be found in the schema here:

<xs:import namespace="http://ddex.net/xml/avs/avs" schemaLocation="http://ddex.net/xml/avs/avs_20161006.xsd"/>