Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions node-rss.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ var callback = function() {};
// The main "meat" of this module - parses an rss feed and triggers
// the callback when done.
// using node-xml: http://github.com/robrighter/node-xml
var parser = new xml.SaxParser(function(cb) {
var parser = function() {
return new xml.SaxParser(function(cb) {
var articles = Array();
var current_element = false;
var article_count = 0;
Expand Down Expand Up @@ -93,6 +94,7 @@ var parser = new xml.SaxParser(function(cb) {
sys.puts('<ERROR>'+JSON.stringify(msg)+"</ERROR>");
});
});
};


/**
Expand All @@ -103,7 +105,7 @@ var parser = new xml.SaxParser(function(cb) {
*/
exports.parseFile = function(file, cb) {
callback = cb;
parser.parseFile(file);
parser().parseFile(file);
}
/**
* parseURL()
Expand Down Expand Up @@ -142,7 +144,7 @@ exports.parseURL = function(url, cb) {
body += chunk;
});
response.addListener('end', function() {
parser.parseString(body);
parser().parseString(body);
});
break;
// redirect status returned
Expand Down