Transform stream for parsing large XML files. It is using SAX module internally. Emits objects: one object per each selected node.
$ npm install sax-stream
Use as any transform stream: pipe request or file stream to it, pipe it downstream to another
transform/writeable stream or handle data
event.
var saxStream = require('sax-stream');
request('http://blog.npmjs.org/rss')
.pipe(saxStream({
strict: true,
tag: 'item'
})
.on('data', function(item) {
console.log(item);
});
Create passing options object:
omitNsPrefix
- if set totrue
, removes namespace prefix of elementstag
- name of the tag to select objects from XML file (this ortags
is required)tags
- name of tags to select objects from XML file (this ortag
is required)highWaterMark
- size of internal transform stream buffer - defaults to 350 objectsstrict
- default to false, iftrue
makes sax parser to accept valid XML onlynormalize
,lowercase
,xmlns
,position
,strictEntities
,noscript
- passed to sax parser
MIT