From 3c7b431413e892cd36b7e06922fcf375baeb0630 Mon Sep 17 00:00:00 2001 From: Martin Wind Date: Thu, 15 Jan 2015 12:42:58 +0100 Subject: [PATCH] update xml2js to 0.4.4 --- epub.js | 10 ++++++---- package.json | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/epub.js b/epub.js index 3d9aafa..a86dda0 100644 --- a/epub.js +++ b/epub.js @@ -1,4 +1,5 @@ -var XML2JS = require("xml2js").Parser; +var xml2js = require('xml2js'); +var xml2jsOptions = xml2js.defaults['0.1']; var util = require('util'); var EventEmitter = require('events').EventEmitter; @@ -171,12 +172,13 @@ EPub.prototype.getRootFiles = function () { return; } var xml = data.toString("utf-8").toLowerCase().trim(), - xmlparser = new XML2JS(); + xmlparser = new xml2js.Parser(xml2jsOptions); xmlparser.on("end", (function (result) { if (!result.rootfiles || !result.rootfiles.rootfile) { this.emit("error", new Error("No rootfiles found")); + console.dir(result); return; } @@ -248,7 +250,7 @@ EPub.prototype.handleRootFile = function () { return; } var xml = data.toString("utf-8"), - xmlparser = new XML2JS(); + xmlparser = new xml2js.Parser(xml2jsOptions); xmlparser.on("end", this.parseRootFile.bind(this)); @@ -471,7 +473,7 @@ EPub.prototype.parseTOC = function () { return; } var xml = data.toString("utf-8"), - xmlparser = new XML2JS(); + xmlparser = new xml2js.Parser(xml2jsOptions); xmlparser.on("end", (function (result) { if (result.navMap && result.navMap.navPoint) { diff --git a/package.json b/package.json index 3cdffb7..cc3b773 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ ], "dependencies": { "adm-zip": "^0.4.4", - "xml2js": "~0.1.0" + "xml2js": "^0.4.4" }, "optionalDependencies": { "zipfile": "^0.5.0"