diff --git a/packages/node_modules/@node-red/nodes/core/parsers/70-XML.js b/packages/node_modules/@node-red/nodes/core/parsers/70-XML.js index 3bfd38101..a778c4d72 100644 --- a/packages/node_modules/@node-red/nodes/core/parsers/70-XML.js +++ b/packages/node_modules/@node-red/nodes/core/parsers/70-XML.js @@ -10,7 +10,7 @@ module.exports = function(RED) { this.charkey = n.chr; this.property = n.property||"payload"; var node = this; - this.on("input", function(msg) { + this.on("input", function(msg,send,done) { var value = RED.util.getMessageProperty(msg,node.property); if (value !== undefined) { var options; @@ -21,7 +21,8 @@ module.exports = function(RED) { var builder = new xml2js.Builder(options); value = builder.buildObject(value, options); RED.util.setMessageProperty(msg,node.property,value); - node.send(msg); + send(msg); + done(); } else if (typeof value == "string") { options = {}; @@ -30,17 +31,18 @@ module.exports = function(RED) { options.attrkey = node.attrkey || options.attrkey || '$'; options.charkey = node.charkey || options.charkey || '_'; parseString(value, options, function (err, result) { - if (err) { node.error(err, msg); } + if (err) { done(err); } else { value = result; RED.util.setMessageProperty(msg,node.property,value); - node.send(msg); + send(msg); + done(); } }); } - else { node.warn(RED._("xml.errors.xml_js")); } + else { node.warn(RED._("xml.errors.xml_js")); done(); } } - else { node.send(msg); } // If no property - just pass it on. + else { send(msg); done(); } // If no property - just pass it on. }); } RED.nodes.registerType("xml",XMLNode);