How to use the sax/lib/sax.createStream function in sax

To help you get started, we’ve selected a few sax examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angular / angular.js / i18n / ucd / src / extractValues.js View on Github external
function extractValues(stream, propertiesToExtract, callback) {
  var saxStream = sax.createStream(saxStrict, saxOptions);
  var firstValid = {};
  var lastValid = {};
  var keys = Object.keys(propertiesToExtract);
  var keyValues = keys.map(function(k) { return propertiesToExtract[k]; });
  var validRanges = {};

  for (var i in keys) {
    validRanges[keys[i] + '_' + keyValues[i]] = [];
  }
  saxStream.onopentag = onOpenTag;
  stream
    .pipe(saxStream)
    .on('end', doCallback);

  function onOpenTag(node) {
    var property;

sax

An evented streaming XML parser in JavaScript

ISC
Latest version published 7 months ago

Package Health Score

77 / 100
Full package analysis