Skip to content

RobinBuschmann/sax-stream

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Dependency Status NPM version

sax-stream

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

Usage

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);
  });

API

Create passing options object:

  • omitNsPrefix - if set to true, removes namespace prefix of elements
  • tag - name of the tag to select objects from XML file (this or tags is required)
  • tags - name of tags to select objects from XML file (this or tag is required)
  • highWaterMark - size of internal transform stream buffer - defaults to 350 objects
  • strict - default to false, if true makes sax parser to accept valid XML only
  • normalize, lowercase, xmlns, position, strictEntities, noscript - passed to sax parser

License

MIT

About

Transform stream implemented using SAX parser

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 97.5%
  • HTML 1.4%
  • Makefile 1.1%