saxophonist
Extract elements from large XML files with node.js streams
Last updated 4 months ago by matteo.collina .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install saxophonist 
SYNC missed versions from official npm registry.

saxophonist

Extract elements from large XML files with node.js streams

Usage

'use strict'

var fs = require('fs')
var p = require('path')
var saxophonist = require('./')
var count = 0

console.time('parsing time')

fs.createReadStream(p.join(__dirname, 'wikipedia', '1.xml'))
  .pipe(saxophonist('page'))
  .on('data', function () {
    count++
  })
  .on('end', function () {
    console.timeEnd('parsing time')
    console.log('read', count, 'pages')
  })

The data format is:

{
  path: ['a', 'path', 'to', 'page'], // the path in the XML document
  children: null, // or an array with elements like this
  attributes: {}, // object with all element attribute
  text: null // or string, containing the element text
}

Acknowledgements

saxophonist is sponsored by nearForm.

License

MIT

Current Tags

  • 2.0.0                                ...           latest (4 months ago)

2 Versions

  • 2.0.0                                ...           4 months ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |