johnlumley / jwiXML

An iXML processor for JavaScript and SaxonJS
MIT License
13 stars 0 forks source link

jωiXML Processor

John Lumley

2024feb13

This is the README for the jωiXML Invisible XML processor, version 1.1.0, to run from an XSLT program executing in a browser, using SaxonJS and a custom-constructed ixml 'engine' written in JavaScript. It contains the necessary JavaScript library, an XSLT 'stub' set of functions to invoke from XSLT, and a sample application. An interactive iXML 'workbench' is also available.

For fuller details of Invisible XML see https://invisiblexml.org/. For details of SaxonJS see Saxonica

One-stop setup and go

Firstly unzip the file jwiXML.zip into a folder in your localhost web server. Then load the web page sample/jwiXML.sample.xhtml into your browser from your local host. You should see a display of a grammar, a very simple input and the resulting parse tree.

To generate your own application within a SaxonJS environment:

Status of the implementation

At present it appears to be running well and is capable of processing the ixml specification using the grammar of the ixml specification in O(300ms). I consider it to have reasonable production status, with fully-functioning code that passes all (non-infinitely-ambiguous) grammar and parse tests in the current test suite. The areas under development/change include:

Conformance

The processor passes all non-infinitely-ambiguous tests in the test suite.

Currently the API parsing functions produce an XDM map as output, within which the result tree is the value of an entry, rather than a (serialised?) document, as required by the standard.

I have decided that this processor will not conform to support processing of infinitely ambiguous grammars, as apart from theoretical completeness they are of no practical value. As stated above the processor will stop parsing after processing 1000 consecutive states for a character classification.

Supplied files

There are four types of files in this distribution:

  1. The compiled Javascript file that defines the iXML processor: dist/jwiXML.adv.cls.js.
  2. An XSLT library file (dist/jwiXML.processor.xsl) which provides a small set of XSLT functions for compiling iXML grammars to run in the processor. See below and comments within that file for descriptions of those functions.
  3. A sample web page (sample/jwiXMLsample.xhtml) which loads SaxonJS and the iXML processor and executes the exported form (sample/jwiXML.sample.sef.json) of a trivial sample XSLT program jwiXML.sample.xsl.
  4. A runtime version of SaxonJS 2.6 (in directory SaxonJS) referenced from the web page, and included subject to the LICENCE file therein.

Interactive workbench

An interactive iXML 'workbench' using jωiXML is available, from which grammars and input strings can be loaded, edited and processed from a variety of sources including the InvisibleXML test suites and sample grammars, as well as local filestores.

Version 1.4 of the workbench (released February 2024) uses version 1.1.0 of the processor

SaxonJS/XSLT invocation

The XSLT file dist/jwiXML.processor.xsl provides all necessary interfaces to compile and use iXML grammars to parse input strings. The three most frequently used are the functions:

This file also contains XSLT-coded implementations of

(See the comments in the XSLT file for more details.)

JavaScript invocation

To be completed

Change History

2024feb13 - V 1.1.0

It's called jωiXML for reasons induced by my electrical engineering background.