I use https://github.com/jindw/xmldom and want check parseerrors on XML files. The documentation write it's necessary to overwrite locator + errorHandler on constructor of DOMParser.
But I can't find anywhere code example, how to use these in node context.
Documentation say:
//errorHandler is supported
new DOMParser({
/**
* locator is always need for error position info
*/
locator:{},
/**
* you can override the errorHandler for xml parser
* @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html
*/
errorHandler:{warning:function(w){console.warn(w)},error:callback,fatalError:callback}
//only callback model
//errorHandler:function(level,msg){console.log(level,msg)}
})
This is the runable code: