Skip to content

Instantly share code, notes, and snippets.

View lcahlander's full-sized avatar

Loren Cahlander lcahlander

View GitHub Profile
@lcahlander
lcahlander / xsd2json.xqy
Last active April 9, 2019 14:13
Translate an XML Schema into equivalent JSON Schema
xquery version "3.1";
(:~
This XQuery library module transforms an XML Schema to a JSON Schema equivalent.
NOTE: This is a work in progress. I would appreciate any comments to make it more robust.
To execute the transformation, place the followin in another XQuery module.
xquery version "3.1";
import module namespace xsd2json="http://easymetahub.com/ns/xsd2json" at "xsd2json.xqy";
@lcahlander
lcahlander / tsgen.xqm
Last active May 29, 2019 14:00
This library module walks an XML Schema and generates the stubs for a typeswitch transform to process a document from that schema.
(:
Copyright (c) 2017. EasyMetaHub, LLC
This work is licensed under a
<a rel="license" href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.
:)
xquery version "3.1";
(:~
This library module walks an XML Schema and generates the stubs for a typeswitch
@lcahlander
lcahlander / encchars.xqy
Last active April 24, 2018 20:15
The module contains variables for each of the unicode escape sequences at https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
xquery version "1.0";
(:~
The module contains variables for each of the unicode escape sequences at
<a href="https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references">https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references</a>
:)
module namespace encchars="http://w3.org/encoded/characters";
(: Name Escape Sequence Description :)
declare variable $encchars:quot := "&#34;"; (: quotation mark (APL quote) :)