tido-mei-validation
Validating MEI in node
Install
git clone https://github.com/tido/mei-validation.gitcd mei-validationnpm install
Java dependency
Beside the npm dependencies, you will also need to have a Java Runtime Environment (JRE) installed.
Usage
You can validate XML strings asynchronously by calling validate
, which returns a Promise:
var validation = ;validation ;
validate
depends on a global Promise object, which is available in node
natively since v4.0.0. If you'd like to run validation on an older version
of Node, you need to install a Promise polyfill.
The synchronous counterpart of validate
, validateSync
, can be used this way:
var validation = ;var report = validation;
Both functions take a string providing the input XML as first argument. The second
argument, schemaPaths
, must be an object that specifies the paths to an RNG
schema and an XSLT stylesheet for Schematron validation with Saxon:
var schemaPaths = rng: 'path/to/rng/schema.rng' schematron: 'path/to/schmatron/schema.xsl';