[Groonga-commit] groonga/gcs [master] Upgrade xml2js to the latest version #118

Back to archive index

Yoji SHIDARA null+****@clear*****
Wed Dec 12 19:39:22 JST 2012


Yoji SHIDARA	2012-12-12 19:39:22 +0900 (Wed, 12 Dec 2012)

  New Revision: e2a8b8794dd844eb0dd84d255cb00538fa2d5f5d
  https://github.com/groonga/gcs/commit/e2a8b8794dd844eb0dd84d255cb00538fa2d5f5d

  Log:
    Upgrade xml2js to the latest version #118

  Modified files:
    lib/batch/xml.js
    npm-shrinkwrap.json
    package.json
    test/test-utils.js
    tools/scenario-runner.js

  Modified: lib/batch/xml.js (+3 -3)
===================================================================
--- lib/batch/xml.js    2012-12-12 17:56:25 +0900 (8c928a7)
+++ lib/batch/xml.js    2012-12-12 19:39:22 +0900 (51c9530)
@@ -1,9 +1,9 @@
 var xml2js = require('xml2js');
+var xml2jsConfig = JSON.parse(JSON.stringify(xml2js.defaults['0.1']));
+xml2jsConfig.explicitRoot = true;
 
 function _toJSON(xml) {
-  var parser = new xml2js.Parser({
-                 explicitRoot: true
-               });
+  var parser = new xml2js.Parser(xml2jsConfig);
   var json;
   parser.addListener('end', function(result) {
     json = result;

  Modified: npm-shrinkwrap.json (+9 -1)
===================================================================
--- npm-shrinkwrap.json    2012-12-12 17:56:25 +0900 (032ed44)
+++ npm-shrinkwrap.json    2012-12-12 19:39:22 +0900 (f9b788c)
@@ -11,6 +11,14 @@
         "underscore": {
           "version": "1.4.3"
         },
+        "xml2js": {
+          "version": "0.1.14",
+          "dependencies": {
+            "sax": {
+              "version": "0.4.2"
+            }
+          }
+        },
         "xml": {
           "version": "0.0.7"
         },
@@ -192,7 +200,7 @@
       }
     },
     "xml2js": {
-      "version": "0.1.14",
+      "version": "0.2.2",
       "dependencies": {
         "sax": {
           "version": "0.4.2"

  Modified: package.json (+1 -1)
===================================================================
--- package.json    2012-12-12 17:56:25 +0900 (7ce7011)
+++ package.json    2012-12-12 19:39:22 +0900 (1eecff3)
@@ -28,7 +28,7 @@
     "node-uuid": "",
     "nroonga": "",
     "winston": "",
-    "xml2js": "0.1.14",
+    "xml2js": "",
     "xmlbuilder": "0.3.11"
   },
   "scripts": {

  Modified: test/test-utils.js (+4 -4)
===================================================================
--- test/test-utils.js    2012-12-12 17:56:25 +0900 (9250933)
+++ test/test-utils.js    2012-12-12 19:39:22 +0900 (314aad5)
@@ -8,6 +8,8 @@ var nativeNroonga = require('nroonga');
 var wrappedNroonga = require(__dirname + '/../lib/wrapped-nroonga');
 var rmRSync = require(__dirname + '/../lib/rm').rmRSync;
 var xml2js = require('xml2js');
+var xml2jsConfig = JSON.parse(JSON.stringify(xml2js.defaults['0.1']));
+xml2jsConfig.explicitRoot = true;
 var spawn = require('child_process').spawn;
 var url = require('url');
 
@@ -132,10 +134,8 @@ exports.loadDumpFile = function(context, path) {
 exports.rmRSync = rmRSync;
 
 function XMLStringToJSON(xml) {
-  var xml2js = require('xml2js');
-  var parser = new xml2js.Parser({
-                 explicitRoot: true
-               });
+  var parser = new xml2js.Parser(xml2jsConfig);
+
   var json;
   parser.addListener('end', function(result) {
     json = result;

  Modified: tools/scenario-runner.js (+4 -4)
===================================================================
--- tools/scenario-runner.js    2012-12-12 17:56:25 +0900 (6e52ba3)
+++ tools/scenario-runner.js    2012-12-12 19:39:22 +0900 (f37b91f)
@@ -1,6 +1,8 @@
 var Client = require(__dirname + '/../lib/client').Client;
 var EventEmitter = require('events').EventEmitter;
 var xml2js = require('xml2js');
+var xml2jsConfig = JSON.parse(JSON.stringify(xml2js.defaults['0.1']));
+xml2jsConfig.explicitRoot = true;
 
 var statusCodeTable = {
   500: 'Inetnal Server Error',
@@ -247,7 +249,7 @@ ScenarioRunner.prototype._process = function(scenario, callback) {
 
     var statusCode = response.StatusCode;
     if (statusCode == 400) {
-      var parser = new xml2js.Parser({ explicitRoot: true });
+      var parser = new xml2js.Parser(xml2jsConfig);
       parser.parseString(response.Body, function(error, result) {
         var errorCode = result.ErrorResponse.Error.Code;
         if (errorCode === 'Throttling') {
@@ -310,9 +312,7 @@ Response.prototype = {
     return this._body;
   },
   _XMLStringToJSON: function(xml) {
-    var parser = new xml2js.Parser({
-                   explicitRoot: true
-                 });
+    var parser = new xml2js.Parser(xml2jsConfig);
     var json;
     parser.addListener('end', function(result) {
       json = result;
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index