examples/encoding.js
function setup(encoding) {
  var stream = fs.createReadStream(path.join(__dirname, 'encoding.xml'));
  var xml = new XmlStream(stream, encoding);
  xml.on('endElement: node', function(node) {
    console.log(node);
  });
  xml.on('error', function(message) {
    console.log('Parsing as ' + (encoding || 'auto') + ' failed: ' + message);
  });
  return xml;
}
function setup(encoding) {
  var stream = fs.createReadStream(path.join(__dirname, 'encoding.xml'));
  var xml = new XmlStream(stream, encoding);
  xml.on('endElement: node', function(node) {
    console.log(node);
  });
  xml.on('error', function(message) {
    console.log('Parsing as ' + (encoding || 'auto') + ' failed: ' + message);
  });
  return xml;
}
function setup ( encoding ) { var stream = fs . createReadStream ( path . join ( __dirname , 'encoding.xml' ) ) ; var xml = new XmlStream ( stream , encoding ) ; xml . on ( 'endElement: node' , function ( node ) { console . log ( node ) ; } ) ; xml . on ( 'error' , function ( message ) { console . log ( 'Parsing as ' + ( encoding || 'auto' ) + ' failed: ' + message ) ; } ) ; return xml ; }
Create a file stream and pass it to XmlStream
Create a file stream and pass it to XmlStream