fnogatz / xsd2json

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

Support of xs:extension and xs:include #3

Open albanm opened 9 years ago

albanm commented 9 years ago

Thanks for the impressive piece of work.

In your thesis you specifically mention that xsd2json doesn't support the extension of complex types. Do you have any project to fill this gap ? If not, do you have a solution in mind to implement this functionality that maybe another developer could contribute ?

I have no deep understanding of the problem or of your program, but I wonder if the simplest solution could be to do some merging of the complex types definitions before applying CHR rules ?

I also wonder about include and import that you say are not supported. Do you think a simple merge of included schemas in the root schema will do the trick ?

Basically: do you think a not too complex tranformation (xslt or other) applied on the schemas before processing by xsd2json could help overcome its limitations ?

Alban

fnogatz commented 9 years ago

Hi Alban,

both problems are still there as I had no time to implement them yet :) The extension of complex types as well as xs:include and xs:import could be handled by XSLT of course, but I would prefer using only CHR. Especially as the namespace support is already implemented in xsd2json but currently not really used.

The best would be if you could provide some simple test cases in the /test directory. PRs welcome :)

I will take some time on the weekend to investigate possible solutions. What do you need first? Extensions or includes?

fnogatz commented 9 years ago

Support of xs:include and xs:import has been added.

rudda commented 4 years ago

are there some example to use it? I have a xsd file with include tag but I need to give a path where are all include xsd files dependencies ?

fnogatz commented 4 years ago

The tests under /test/xsd contain some examples, maybe they are helpful for you?