{"id":14036811,"url":"https://github.com/fnogatz/xsd2json","last_synced_at":"2025-04-07T18:14:34.201Z","repository":{"id":16140616,"uuid":"18886075","full_name":"fnogatz/xsd2json","owner":"fnogatz","description":"Translate XML Schema into equivalent JSON Schema","archived":false,"fork":false,"pushed_at":"2023-01-23T18:54:23.000Z","size":3137,"stargazers_count":153,"open_issues_count":20,"forks_count":27,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-03-31T11:06:20.835Z","etag":null,"topics":["json-schema","prolog","swi-prolog","xml-schema"],"latest_commit_sha":null,"homepage":null,"language":"Prolog","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fnogatz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-17T16:50:07.000Z","updated_at":"2025-02-02T21:58:48.000Z","dependencies_parsed_at":"2023-02-13T02:15:51.264Z","dependency_job_id":null,"html_url":"https://github.com/fnogatz/xsd2json","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnogatz%2Fxsd2json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnogatz%2Fxsd2json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnogatz%2Fxsd2json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnogatz%2Fxsd2json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fnogatz","download_url":"https://codeload.github.com/fnogatz/xsd2json/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247704571,"owners_count":20982298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json-schema","prolog","swi-prolog","xml-schema"],"created_at":"2024-08-12T03:02:14.831Z","updated_at":"2025-04-07T18:14:34.182Z","avatar_url":"https://github.com/fnogatz.png","language":"Prolog","funding_links":[],"categories":["Prolog"],"sub_categories":[],"readme":"# xsd2json\n\nTranslate an XML Schema into equivalent JSON Schema based on SWI-Prolog and Constraint Handling Rules (CHR). For usage directly in Prolog or node.js.\n\n## Installation\n\nFirst, make sure [SWI-Prolog](http://www.swi-prolog.org/) is installed. This module expects the `swipl` binary to be in PATH somewhere. In other words, type this:\n\n```bash\nswipl\n```\n\nIf that works, so will xsd2json.\n\nUsing [npm](http://npmjs.org/), you can install xsd2json by calling this:\n\n```bash\nnpm install -g xsd2json\n```\n\nOr simply clone this repository and manually run the `preinstall` scripts to [create pre-compiled Prolog files](https://github.com/fnogatz/xsd2json/tree/master/lib-pl#pre-compilation):\n\n```bash\ngit clone https://github.com/fnogatz/xsd2json.git\nnpm run preinstall\n```\n\n## Usage as CLI\n\nIf you install xsd2json via npm it will create a new command `xsd2json`:\n\n```bash\nxsd2json /path/to/your.xsd \u003e /created/schema.json\n```\n\n## Usage with node.js\n\nThe xsd2json module can be used programmatically as function or stream:\n\n```js\nvar xsd2json = require('xsd2json');\nvar filename = 'test.xsd';\n\n// use as stream: Read from stdin\nxsd2json(filename)\n  .pipe(process.stdout);\n\n// use as function\nxsd2json(filename, function(err, schemaObject) {\n  console.log(JSON.stringify(schemaObject, null, 2));\n});\n```\n\nIn addition to the [command line options provided by the Prolog module](https://github.com/fnogatz/xsd2json/tree/master/lib-pl#synopsis), there are the following options available in the node.js module:\n- `noExe: true | false (default)`: Use the native Prolog interface instead of the pre-compiled `cli.exe`. This might be useful for MacOS users (see [issue #87](https://github.com/fnogatz/xsd2json/issues/87) for more details).\n- `swi: 'swipl' (default)`: Executable to call SWI-Prolog.\n\n## Usage with Prolog\n\nxsd2json provides a predicate `xsd2json(+XSD,-JSON)`, which holds for a given XML Schema (either file path, URL or `stream`). For instructions on how to use xsd2json programmatically in Prolog, have a look at the Prolog module's [Readme](https://github.com/fnogatz/xsd2json/tree/master/lib-pl).\n\n## Background\n\nThis tool has been developed as part of my Bachelor's Thesis at University of Ulm, Germany. The thesis ([PDF](http://www.informatik.uni-ulm.de/pm/fileadmin/pm/home/fruehwirth/drafts/Bsc-Nogatz.pdf)) explains the general idea of the translation process via Prolog and [Constraint Handling Rules](http://dtai.cs.kuleuven.be/CHR/about.shtml) (CHR). It also contains tabular and graphical representations of the implemented translations of XML Schema fragments. A shorter explanation of the translation process can be found in the CHR Workshop paper [\"From XML Schema to JSON Schema:\nTranslation with CHR\"](http://arxiv.org/pdf/1406.2125v1.pdf).\n\n## Project Structure\n\nxsd2json is developed in a test-driven way. This reflects in the project's folder structure, too: The `/lib-pl` directory contains the Prolog and CHR stuff while you will find the [TAP](http://testanything.org/) testing framework implemented in [node.js](http://nodejs.org/) under `/test`. Both directories contain their own Readme-File that explain their usage.\n\n## Known Bugs\n\nxsd2json's tests are always executed using the latest stable release of SWI-Prolog. Make sure to have the latest version installed before you file a bug.\n\nApparently SWI-Prolog of version 7.2.x ships with a bug in the CHR implementation. Use version 7.4 or higher instead.\n\n## Alternatives\n\n* [node-xsd2json](https://github.com/MGDIS/xsd2json) (Fork of this module.)\n* [Jsonix Schema Compiler](https://github.com/highsource/jsonix-schema-compiler)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnogatz%2Fxsd2json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffnogatz%2Fxsd2json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnogatz%2Fxsd2json/lists"}