Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-expat

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-expat - npm Package Compare versions

Comparing version 1.4.5 to 1.5.0

3

lib/node-expat.js

@@ -43,2 +43,5 @@ var EventEmitter = require('events').EventEmitter;

};
exports.Parser.prototype.reset = function() {
return this.parser.reset();
};
exports.Parser.prototype.getCurrentLineNumber = function() {

@@ -45,0 +48,0 @@ return this.parser.getCurrentLineNumber();

4

package.json
{ "name": "node-expat"
,"version": "1.4.5"
,"version": "1.5.0"
,"main": "./lib/node-expat"

@@ -21,5 +21,5 @@ ,"description": "NodeJS binding for fast XML parsing."

}
,"contributors": ["Stephan Maka", "Derek Hammer", "Iein Valdez", "Peter Körner", "Camilo Aguilar", "Michael Weibel"]
,"contributors": ["Stephan Maka", "Derek Hammer", "Iein Valdez", "Peter Körner", "Camilo Aguilar", "Michael Weibel", "Alexey Zhuchkov", "Satyam Shekhar"]
,"licenses": [{ "type": "MIT" }]
,"engines": { "node": ">=0.4" }
}

@@ -25,5 +25,9 @@ var expat = require('./lib/node-expat');

function expect(s, evs_expected) {
for(var step = s.length; step > 0; step--) {
for(var step = s.length; step > 0; step--) {
expectWithParserAndStep(s, evs_expected, new expat.Parser("UTF-8"), step);
}
}
function expectWithParserAndStep(s, evs_expected, p, step) {
var evs_received = [];
var p = new expat.Parser("UTF-8");
//p.setEncoding("UTF-8");

@@ -70,3 +74,2 @@ p.addListener('startElement', function(name, attrs) {

assert.equal(received, expected);
}
}

@@ -175,2 +178,23 @@

},
'reset': {
'complete doc without error': function() {
var p = new expat.Parser("UTF-8");
expectWithParserAndStep("<start><first /><second>text</second></start>", [['startElement', 'start', {}], ['startElement', 'first', {}], ['endElement', 'first'], ['startElement', 'second', {}], ['text', "text"], ['endElement', 'second'], ['endElement', 'start']], p, 1000);
p.reset();
expectWithParserAndStep("<restart><third>moretext</third><fourth /></restart>", [['startElement', 'restart', {}], ['startElement', 'third', {}], ['text', "moretext"], ['endElement', 'third'], ['startElement', 'fourth', {}], ['endElement', 'fourth'], ['endElement', 'restart']], p, 1000);
},
'incomplete doc without error': function() {
var p = new expat.Parser("UTF-8");
expectWithParserAndStep("<start><first /><second>text</second>", [['startElement', 'start', {}], ['startElement', 'first', {}], ['endElement', 'first'], ['startElement', 'second', {}], ['text', "text"], ['endElement', 'second']], p, 1000);
p.reset();
expectWithParserAndStep("<restart><third>moretext</third><fourth /></restart>", [['startElement', 'restart', {}], ['startElement', 'third', {}], ['text', "moretext"], ['endElement', 'third'], ['startElement', 'fourth', {}], ['endElement', 'fourth'], ['endElement', 'restart']], p, 1000);
},
'with doc error': function() {
var p = new expat.Parser("UTF-8");
expectWithParserAndStep("</end>", [["error"]], p, 1000);
p.reset();
expectWithParserAndStep("<restart><third>moretext</third><fourth /></restart>", [['startElement', 'restart', {}], ['startElement', 'third', {}], ['text', "moretext"], ['endElement', 'third'], ['startElement', 'fourth', {}], ['endElement', 'fourth'], ['endElement', 'restart']], p, 1000);
}
},
'stop and resume': {

@@ -240,4 +264,4 @@ topic: function() {

assert.ok(true, "Did not segfault");
},
},
'parsing twice the same document with the same parser instance should be fine': 'reset() not yet implemented'

@@ -244,0 +268,0 @@ /*function() {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc