Closed ClaysonIO closed 8 years ago
Can you please doublecheck that endElement: r25:item
event is not emitted AFTER end
in your case (just put a decent timeout before running callback)?
In my case what I found - after end
I can still receive several endElement
events.
The solution I came up with is to listen to endElement of your root XML element instead of stream end:
something like:
xml.on('endElement: data_container', function(data){
console.log("EventCount", allEvents.length);
console.log();
job.done();
cb();
})
and remove xml.on('end')
listener
Apologies for the delay -- I don't have access to the API that was causing this issue any more (short term project), so I can't do additional trouble shooting. The next time I work on a similar system, I'll see about getting more data.
Thanks.
I'm using xml-stream inside a nodejs worker, retrieving xml using the request package. For some reason, I can pull data from moderately large files, but not from short ones. On short documents, the only event to be called is 'end'.
I've verified that the documents are coming through, but haven't been able to figure out why the events aren't firing.