xml2js
Advanced tools
Comparing version 0.4.12 to 0.4.13
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ "use strict"; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ "use strict"; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -252,13 +252,21 @@ "use strict"; | ||
Parser.prototype.processAsync = function() { | ||
var chunk; | ||
if (this.remaining.length <= this.options.chunkSize) { | ||
chunk = this.remaining; | ||
this.remaining = ''; | ||
this.saxParser = this.saxParser.write(chunk); | ||
return this.saxParser.close(); | ||
} else { | ||
chunk = this.remaining.substr(0, this.options.chunkSize); | ||
this.remaining = this.remaining.substr(this.options.chunkSize, this.remaining.length); | ||
this.saxParser = this.saxParser.write(chunk); | ||
return setImmediate(this.processAsync); | ||
var chunk, err, error1; | ||
try { | ||
if (this.remaining.length <= this.options.chunkSize) { | ||
chunk = this.remaining; | ||
this.remaining = ''; | ||
this.saxParser = this.saxParser.write(chunk); | ||
return this.saxParser.close(); | ||
} else { | ||
chunk = this.remaining.substr(0, this.options.chunkSize); | ||
this.remaining = this.remaining.substr(this.options.chunkSize, this.remaining.length); | ||
this.saxParser = this.saxParser.write(chunk); | ||
return setImmediate(this.processAsync); | ||
} | ||
} catch (error1) { | ||
err = error1; | ||
if (!this.saxParser.errThrown) { | ||
this.saxParser.errThrown = true; | ||
return this.emit(err); | ||
} | ||
} | ||
@@ -300,2 +308,10 @@ }; | ||
})(this); | ||
this.saxParser.onend = (function(_this) { | ||
return function() { | ||
if (!_this.saxParser.ended) { | ||
_this.saxParser.ended = true; | ||
return _this.emit("end", _this.resultObject); | ||
} | ||
}; | ||
})(this); | ||
this.saxParser.ended = false; | ||
@@ -340,3 +356,3 @@ this.EXPLICIT_CHARKEY = this.options.explicitCharkey; | ||
return function() { | ||
var cdata, emptyStr, err, key, node, nodeName, obj, objClone, old, s, xpath; | ||
var cdata, emptyStr, err, error1, key, node, nodeName, obj, objClone, old, s, xpath; | ||
obj = stack.pop(); | ||
@@ -382,4 +398,4 @@ nodeName = obj["#name"]; | ||
obj = _this.options.validator(xpath, s && s[nodeName], obj); | ||
} catch (_error) { | ||
err = _error; | ||
} catch (error1) { | ||
err = error1; | ||
_this.emit("error", err); | ||
@@ -462,3 +478,3 @@ } | ||
Parser.prototype.parseString = function(str, cb) { | ||
var err; | ||
var err, error1; | ||
if ((cb != null) && typeof cb === "function") { | ||
@@ -474,8 +490,8 @@ this.on("end", function(result) { | ||
} | ||
str = str.toString(); | ||
if (str.trim() === '') { | ||
this.emit("end", null); | ||
return true; | ||
} | ||
try { | ||
str = str.toString(); | ||
if (str.trim() === '') { | ||
this.emit("end", null); | ||
return true; | ||
} | ||
str = bom.stripBOM(str); | ||
@@ -488,4 +504,4 @@ if (this.options.async) { | ||
return this.saxParser.write(str).close(); | ||
} catch (_error) { | ||
err = _error; | ||
} catch (error1) { | ||
err = error1; | ||
if (!(this.saxParser.errThrown || this.saxParser.ended)) { | ||
@@ -492,0 +508,0 @@ this.emit('error', err); |
@@ -9,4 +9,4 @@ { | ||
"homepage": "https://github.com/Leonidas-from-XIV/node-xml2js", | ||
"version": "0.4.12", | ||
"author": "Marek Kubica <marek@xivilization.net> (http://xivilization.net)", | ||
"version": "0.4.13", | ||
"author": "Marek Kubica <marek@xivilization.net> (https://xivilization.net)", | ||
"contributors": [ | ||
@@ -51,3 +51,3 @@ "maqr <maqr.lollerskates@gmail.com> (https://github.com/maqr)", | ||
"Tom Spencer <fiznool@gmail.com> (http://fiznool.com/)", | ||
"Tristian Flanagan (https://github.com/tflanagan)" | ||
"Tristian Flanagan <tflanagan@datacollaborative.com> (https://github.com/tflanagan)" | ||
], | ||
@@ -72,7 +72,7 @@ "main": "./lib/xml2js", | ||
"devDependencies": { | ||
"coffee-script": ">=1.9.0", | ||
"coffee-script": ">=1.10.0", | ||
"coveralls": "^2.11.2", | ||
"diff": ">=1.0.8", | ||
"docco": ">=0.6.2", | ||
"nyc": "^2.2.1", | ||
"nyc": ">=2.2.1", | ||
"zap": ">=0.2.9" | ||
@@ -79,0 +79,0 @@ }, |
@@ -124,3 +124,3 @@ node-xml2js | ||
If you want to parse multiple files, you have multiple possibilites: | ||
If you want to parse multiple files, you have multiple possibilities: | ||
@@ -368,5 +368,5 @@ * You can create one `xml2js.Parser` per file. That's the recommended one | ||
[![Build Status](https://secure.travis-ci.org/Leonidas-from-XIV/node-xml2js.png?branch=master)](https://travis-ci.org/Leonidas-from-XIV/node-xml2js) | ||
[![Build Status](https://travis-ci.org/Leonidas-from-XIV/node-xml2js.svg?branch=master)](https://travis-ci.org/Leonidas-from-XIV/node-xml2js) | ||
[![Coverage Status](https://coveralls.io/repos/Leonidas-from-XIV/node-xml2js/badge.svg?branch=)](https://coveralls.io/r/Leonidas-from-XIV/node-xml2js?branch=master) | ||
[![Dependency Status](https://david-dm.org/Leonidas-from-XIV/node-xml2js.png)](https://david-dm.org/Leonidas-from-XIV/node-xml2js) | ||
[![Dependency Status](https://david-dm.org/Leonidas-from-XIV/node-xml2js.svg)](https://david-dm.org/Leonidas-from-XIV/node-xml2js) | ||
@@ -373,0 +373,0 @@ The development requirements are handled by npm, you just need to install them. |
Sorry, the diff of this file is not supported yet
3638628
98
597