Best xml validator in nodejs

Hi I am trying to check if the xml data is a valid one or not in nodejs.I used the xmldoc module but it didnt seem to throw me any error when i passed a wrong xml data. I also tried xmltojson parser below is my code

 var xml2js = require('xml2js')
 var parser = new xml2js.Parser();
 parser.on('end', function(POST_VALUE) {
 console.log(POST_VALUE)
 });
 parser.parseString(POST_VALUE);

In POST_VALUE i passed a invalid xml still it didnt throw me any error but did not return any json data I further analysed that there is a option called validator.But it is denoted as a callable.And am not sure how to use that.

I am stuck here any help will be much helpful.

I've attempted a grunt xml validator plugin using libxmljs, you shuld give it a try :)

https://www.npmjs.org/package/libxmljs

https://www.npmjs.org/package/grunt-xml-validator