Valdate an Xml
var saxon = require('saxonXslt');
To validate you need the PEC version of SAxon/C.
try{
var schemaValidator = saxonProcessor.newSchemaValidator();
schemaValidator.registerSchemaFromFile("./test/examples/xsd/cml/schema.xsd");
//important to set true to make the getValidationReport work.
schemaValidator.setProperty("report-node", "true");
schemaValidator.validate("./test/examples/xml/sodium-icosanoate.xml");
var vp=schemaValidator.getValidationReport();
saxonProcessor.release();
}
catch (err) {
console.dir(err.message);
}
The var vp is a XdmNode object