How to use the azure-common.xml2js.Parser function in azure-common

To help you get started, we’ve selected a few azure-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-sdk-for-node / lib / serviceruntime / namedpipeinputchannel.js View on Github external
if (error) {
      return callbackError(error);
    }

    var parts = data.toString().split('\r\n');

    var xml;
    // If there is more than one part (and the \r\n wasnt the final marker).
    if (parts.length > 1 && parts[1].length > 0) {
      xml = parts[1];
    } else {
      xml = parts[0];
    }

    if (parseXml) {
      var parser = new xml2js.Parser();
      error = null;
      parser.on('error', function (e) { error = e; });
      parser.parseString(xml);

      if (parser.resultObject) {
        xml = parser.resultObject;
      }
    }

    callback(error, xml);
  });
};
github BabylonJS / Extensions / LeaderBoard / Zumo / service / node_modules / azure / lib / serviceruntime / namedpipeinputchannel.js View on Github external
if (error) {
      return callbackError(error);
    }

    var parts = data.toString().split('\r\n');

    var xml;
    // If there is more than one part (and the \r\n wasnt the final marker).
    if (parts.length > 1 && parts[1].length > 0) {
      xml = parts[1];
    } else {
      xml = parts[0];
    }

    if (parseXml) {
      var parser = new xml2js.Parser();
      error = null;
      parser.on('error', function (e) { error = e; });
      parser.parseString(xml);

      if (parser.resultObject) {
        xml = parser.resultObject;
      }
    }

    callback(error, xml);
  });
};
github Azure / azure-sdk-for-node / test / framework / hdinsight-test-utils.js View on Github external
function _getTestCredentialData(callback) {
  var file = process.env['AZURE_HDINSIGHT_CREDENTIALFILE'];
  if (!file) {
    file = __dirname + '/creds.xml';
  }
  var parser = new xml2js.Parser();
  fs.readFile(file, 'utf-8', function(err, data) {
    parser.parseString(data, function(err, result) {
      var creds = result.ArrayOfAzureTestCredentials.AzureTestCredentials;
      if (!_.isArray(creds)) {
        creds = [
          creds
        ];
      }
      var retval = { };
      for (var i = 0; i < creds.length; i++) {
        var cred = {
          credsName : creds[i].CredentialsName[0],
          subscriptionId : creds[i].SubscriptionId[0],
          dnsName : creds[i].DnsName[0],
          cluster : creds[i].Cluster[0],
          user : creds[i].AzureUserName[0],
github BabylonJS / Extensions / LeaderBoard / Zumo / service / node_modules / azure / lib / serviceruntime / fileinputchannel.js View on Github external
this._readData(name, function (error, data) {
    if (!error) {
      if (parseXml) {
        var parser = new xml2js.Parser();
        parser.on('error', function (e) { error = e; });
        parser.parseString(data);

        if (parser.resultObject) {
          data = parser.resultObject;
        }
      }

      callback(error, data);
    } else {
      callback(error);
    }
  });
};