🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

sax-stream

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sax-stream - npm Package Compare versions

Comparing version

to
1.2.0

5

History.md
1.2.0 / 2016-02-11
==================
* add support for strict mode and other sax options
1.1.0 / 2016-02-10

@@ -3,0 +8,0 @@ ==================

25

lib/xmlnode.js

@@ -15,3 +15,3 @@ var Transform = require('stream').Transform;

Transform.call(this, {
highWaterMark: 350,
highWaterMark: options.highWaterMark || 350,
objectMode: true

@@ -30,8 +30,3 @@ });

record,
parser = sax.parser(false, {
trim: false,
normalize: false,
xmlns: false,
position: false
});
parser = sax.parser(options.strict || false, prepareParserOptions(options));

@@ -109,1 +104,17 @@ parser.onopentag = function(node) {

};
function prepareParserOptions(options) {
return [
'trim',
'normalize',
'lowercase',
'xmlns',
'position',
'strictEntities'
].reduce(function(opts, name) {
if (name in options) {
opts[name] = options[name];
}
return opts;
}, {});
}
{
"name": "sax-stream",
"version": "1.1.0",
"version": "1.2.0",
"description": "Transform stream implemented using SAX parser",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -17,4 +17,4 @@ [![Build Status](https://img.shields.io/travis/code42day/sax-stream.svg)](http://travis-ci.org/code42day/sax-stream)

Use as any transform stream: pipe request or file stream to it, pipe it to downstream another
transform stream or writeable handle `data` event.
Use as any transform stream: pipe request or file stream to it, pipe it downstream to another
transform/writeable stream or handle `data` event.

@@ -27,2 +27,3 @@ ```javascript

.pipe(saxStream({
strict: true,
tag: 'item'

@@ -38,11 +39,9 @@ })

Create passing options object.
Create passing options object:
`tag` - name of the tag to select objects from XML file
- `tag` - name of the tag to select objects from XML file
- `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
- `trim`, `normalize`, `lowercase`, `xmlns`, `position`, `strictEntities` - passed to [sax] parser
## TODO
- pass more options to `Transform` stream and to `sax` parser (currently `highWaterMark` is hard
coded at 350)
# License

@@ -53,1 +52,2 @@

[transform-stream]: http://nodejs.org/api/stream.html#stream_class_stream_transform
[sax]: https://github.com/isaacs/sax-js#arguments