Permalink
Browse files

Replace xml2js-expat with xml2js

  • Loading branch information...
1 parent cbe9e27 commit f62f42f0bd9c486f69a486ca861a8d9b0bbb3335 @pfleidi committed Aug 15, 2011
Showing with 18 additions and 11 deletions.
  1. +11 −8 lib/wwwdude/parsers.js
  2. +5 −1 package.json
  3. +2 −2 test/wwwdude-contentdelivery.js
View
@@ -34,17 +34,20 @@ module.exports = {
xml: function xml(content, callback) {
if (content) {
- var Xml2Js = require('xml2js-expat');
- var xmlParser = new Xml2Js.Parser(function (result, error) {
- if (error) {
- callback(error);
- } else {
- callback(null, result);
- }
+ var Xml2Js = require('xml2js');
+ var xmlParser = new Xml2Js.Parser();
+
+ xmlParser.addListener('error', function(err) {
+ callback(err);
+ });
+
+ xmlParser.addListener('end', function(result) {
+ callback(null, result);
});
+
xmlParser.parseString(content);
} else {
- callback(null, '');
+ callback(null, {});
}
}
View
@@ -17,7 +17,11 @@
"url" : "http://github.com/pfleidi/node-wwwdude/raw/master/LICENSE"
}],
"dependencies" : {
- "xml2js-expat" : "= 0.2.0"
+ "xml2js" : "= 0.1.9"
+ },
+ "devDependencies": {
+ "expresso",
+ "connect"
},
"engines" : { "node": ">= 0.2.0" },
"main" : "index"
@@ -71,5 +71,5 @@ exports.assertNullPayloadJson = function (beforeExit) {
};
exports.assertNullPayloadXml = function (beforeExit) {
- _assertWithNullPayload(beforeExit, '', client2);
-};
+ _assertWithNullPayload(beforeExit, {}, client2);
+};

0 comments on commit f62f42f

Please sign in to comment.