1.3.0 • Published 2 years ago
sax-stream-parser v1.3.0
sax-stream-parser
Transform stream for parsing large XML files. It is using SAX module internally. Emits objects: one object per each selected node.
Installation
$ npm install sax-stream-parserUsage
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-parser');
request('http://blog.npmjs.org/rss')
.pipe(saxStream({
strict: true,
tag: 'item'
})
.on('data', function(item) {
console.log(item);
});API
Create passing options object:
tag- name of the tag to select objects from XML file, an Array of tag names can be used - when multiple tags are specified stream pushes{ tag, record }tupleshighWaterMark- size of internal transform stream buffer - defaults to 350 objectsstrict- default to false, iftruemakes sax parser to accept valid XML onlytrim,normalize,lowercase,xmlns,position,strictEntities,noscript- passed to sax parser
License
MIT
1.3.0
2 years ago