- From: Loren Cahlander <loren.cahlander@gmail.com>
- Date: Mon, 18 Dec 2017 13:34:56 -0500
- To: Mukul Gandhi <gandhi.mukul@gmail.com>
- Cc: Loren Cahlander <loren.cahlander@gmail.com>, "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
- Message-Id: <ED5C48BE-4076-4DD1-B5EB-09643A50BDB0@gmail.com>
The library module relies on XQuery 3.1 due to the use of maps. It can be used in MarkLogic with the version of ML that incorporates maps. It can also be run in eXist-db. To run this from the command line would be: java -cp saxon9ee.jar net.sf.saxon.Query -q:load-xsd.xqy -s:schema2translate.xsd -o:translated-schema.json NOTE: I have also added a flag for preserving namespace prefixes in the JSON Schema Create an XQuery file called load-xsd.xqy with the following: xquery version "3.1"; import module namespace xsd2json="http://easymetahub.com/ns/xsd2json" at "xsd2json.xqy"; declare namespace map = "http://www.w3.org/2005/xpath-functions/map"; declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization"; declare namespace xs="http://www.w3.org/2001/XMLSchema"; declare option output:method "json"; declare option output:indent "yes"; xsd2json:run(.//xs:schema, map { ‘keepNamespace’: Fn:true() } ) > On Dec 15, 2017, at 1:36 AM, Mukul Gandhi <gandhi.mukul@gmail.com> wrote: > > I'm trying to run the utility you've created. > > Can you please let me know the command line for same (for e.g, XQueryProcessor <arguments>)? > > On 14 December 2017 at 02:21, Loren Cahlander <loren.cahlander@gmail.com <mailto:loren.cahlander@gmail.com>> wrote: > Hello folks, > > I have started the creation of an XML Schema to JSON Schema transform written in XQuery. I would appreciate the reporting of any issues that you find and any suggestions that you may have for the codebase. > > One question that I received today is how am I handling namespaces. The script, currently, strips out the namespaces. One suggestion was to put the prefix in the property’s name. > > I am figuring that I will need to add the passing of options to the process. Suggestions of options to control the transform are also appreciated. > > It is a work in progress. > > https://gist.github.com/lcahlander/0eecf499dfe307d7aecbb15f775bd4f2 <https://gist.github.com/lcahlander/0eecf499dfe307d7aecbb15f775bd4f2> > > Thank you, > > Loren Cahlander > > > > > -- > Regards, > Mukul Gandhi
Received on Monday, 18 December 2017 18:35:24 UTC