Skip to content

Instantly share code, notes, and snippets.

@petersirka
Created July 3, 2016 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petersirka/23115418183514bfd8067e2d85b979d7 to your computer and use it in GitHub Desktop.
Save petersirka/23115418183514bfd8067e2d85b979d7 to your computer and use it in GitHub Desktop.
require('total.js');
U.download('http://www.w3schools.com/xml/plant_catalog.xml', ['get'], function(err, response) {
response.on('data', U.streamer('<PLANT>', '</PLANT>', function(item, counter) {
// item === a whole element {String}
var obj = item.parseXML();
console.log('--->', obj['PLANT.COMMON'], counter + 1);
}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment