You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If an XML tag contains more than one invalid attribute, such as <one two three>, and parseString is used in async mode, it throws an uncaught error. If the tag contains only one invalid attribute , it doesn't throw the error.
This appears to have been broken by this commit: b4ccc87
Here is a testcase:
var xml2js = require('xml2js');
var parseString = xml2js.parseString;
parseString('<invalid xml string>', {async:true}, function (err, result) {
if (err) {
console.log("Caught",err);
}
else {
console.log('ok');
}
});
Expected result - the callback receives the error:
Caught [Error: Attribute without value
Line: 0
Column: 14
Char: s]
Actual result - the callback receives the error and an uncaught error is throw:
Caught [Error: Attribute without value
Line: 0
Column: 14
Char: s]
events.js:72
throw er; // Unhandled 'error' event
^
Error: Attribute without value
Line: 0
Column: 20
Char: >
at error (/private/tmp/a/node-red/node_modules/xml2js/node_modules/sax/lib/sax.js:652:8)
at strictFail (/private/tmp/a/node-red/node_modules/xml2js/node_modules/sax/lib/sax.js:675:22)
at Object.write (/private/tmp/a/node-red/node_modules/xml2js/node_modules/sax/lib/sax.js:1224:11)
at Parser.exports.Parser.Parser.processAsync (/private/tmp/a/node-red/node_modules/xml2js/lib/xml2js.js:256:41)
at Object._onImmediate (/private/tmp/a/node-red/node_modules/xml2js/lib/xml2js.js:7:59)
at processImmediate [as _immediateCallback] (timers.js:354:15)
If an XML tag contains more than one invalid attribute, such as
<one two three>, andparseStringis used in async mode, it throws an uncaught error. If the tag contains only one invalid attribute , it doesn't throw the error.This appears to have been broken by this commit: b4ccc87
Here is a testcase:
Expected result - the callback receives the error:
Actual result - the callback receives the error and an uncaught error is throw: