Project

Profile

Help

Is SaxonJS 1.1.0 compliant with NodeJS 8.9.4 ?

Added by Julien Guiraud over 6 years ago

I'm trying to run a simple empty code snippet to test SaxonJS 1.1.0 on NodeJs

require('./Saxon-JS-1.1.0/SaxonJS.js');

and I got an error :

PS C:\XXX\sandbox\xsl-transformation> node main.js
C:\XXX\xsl-transformation\Saxon-JS-1.1.0\SaxonJS.js:17136
        setPlatform(JSTestDriver.platform);
                    ^
ReferenceError: JSTestDriver is not defined
at initialize (C:\XXX\sandbox\xsl-transformation\Saxon-JS-1.1.0\SaxonJS.js:17136:25)

Looking at the source code, I can see :

function initialize() {
    "use strict";
    if (inBrowser) {
        setPlatform(BrowserPlatform.platform);
        saxonPrint("Saxon-JS " + getProcessorInfo().productVersion + " in browser", 0);
    } else {
        // Currently only Nashorn. (Later need to distinguish from Node case)
        // Nashorn JSTestDriver
        setPlatform(JSTestDriver.platform);
        saxonPrint("Saxon-JS " + getProcessorInfo().productVersion + " in 
   Nashorn");

        // node NodePlatform
    }

    if (typeof platform.initialize === "function") {
        platform.initialize();
    }
}

It seems Node Platform is not implemented.

However, in the documentation, it is written :

We're talking here primarily about running Saxon-JS in the browser. However, it's also capable of running in server-side JavaScript environments such as Node.js (not yet fully supported in this release).

I deeply searched a code snippet of SaxonJS/NodeJS but I did not find one. Has anyone a snippet code of SaxonJS working on NodeJS ?

I posted my question on stackoverflow too. https://stackoverflow.com/q/50984147/1327729

Kind regards, Julien


Replies (4)

Please register to reply

RE: Is SaxonJS 1.1.0 compliant with NodeJS 8.9.4 ? - Added by Michael Kay over 6 years ago

We've heard of users running the code under Node.JS and we've done some experiments ourselves, but it's not productised and you'll probably need to make small changes in areas like the one you identified.

We hope to provide full support for Node.JS in due course, but it's a significant amount of work because additional functionality is needed, for example the ability to write serialized output to files.

RE: Is SaxonJS 1.1.0 compliant with NodeJS 8.9.4 ? - Added by Julien Guiraud over 6 years ago

Thanks Michael for your quick return.

It's strange because it failed during the loading of the library without any code.

Do you have any roadmap for the NodeJS support, even roughly ? 3 months, 6 months, 1 year ?

Kind regards, Julien

RE: Is SaxonJS 1.1.0 compliant with NodeJS 8.9.4 ? - Added by Michael Kay over 6 years ago

I'm always very reluctant to give dates but perhaps something between 3 months and 6 months for what might be an early and incomplete release.

RE: Is SaxonJS 1.1.0 compliant with NodeJS 8.9.4 ? - Added by Michael Kay over 4 years ago

It took us 2 years rather than 3-6 months, but we got there in the end: Saxon-JS 2.0 runs on Node.js.

    (1-4/4)

    Please register to reply