parser.addListener: end and error both trigger callback if there is trouble with xml.
parser.addListener('end',function(jsonDOM){if(jsonDOM){//...if(callback)callback(null,output);}else{if(callback)callback("failed to parse xml",null);}}parser.addListener("error",function(err){// ...callback=null;});
parser.addListener: end and error both trigger callback if there is trouble with xml.