node-xsd-schema-validator icon indicating copy to clipboard operation
node-xsd-schema-validator copied to clipboard

Validation failing with "invalid xml" for incorrect file path

Open Lukenickerson opened this issue 3 years ago • 1 comments

Describe the Bug

When providing the wrong path to a file, the error given is invalid xml (status=WITH_ERRORS). Nothing in the error points to the real problem: the path provided is not a file.

Steps to Reproduce

const validator = require('xsd-schema-validator');
const schemaFile = './path/to/schema.xsd';
const file = './foo.xml'; // Wrong path - file does not exist
validator.validateXML({ file }, schemaFile, function(err, result) {
   if (err) throw err;
});

Expected Behavior

Error should give some indication that the file you're trying to test is not actually where you think it was.

Environment

  • Node v14.16.0
  • OS: Windows
  • Version 0.7.0

Lukenickerson avatar May 10 '21 20:05 Lukenickerson

Thanks for raising this issue. Would you like to contribute a fix via a PR?

nikku avatar May 10 '21 21:05 nikku