<commit_before>angular.module('AngularRails')
  .controller('CharacterCtrl', ['$scope', '$http', '$rootScope', function ($scope, $http, $rootScope) {
      $scope.bars = ["foo", "bar"];

      $scope.selectedPilot = "default";

      $scope.accountProfile = $rootScope.accountProfile;

      $scope.choosePilot = function() {
        console.log(">>> " + $scope.selectedPilot);
      };

      $scope.loadPilotData = function() {
        var keyID = $scope.accountProfile.keyID;
        var vcode = $scope.accountProfile.vcode;
        var characterID = $scope.accountProfile.characters[$scope.selectedPilot]["character_id"];
        $http({
          method: 'GET',
          url: 'https://api.eveonline.com/char/CharacterSheet.xml.aspx',
          params : {keyID:keyID, vcode:vcode, characterID:characterID}
        })
            .success(function(data) {
              console.log(data);
            });
      };<commit_msg>+ implented XML transform for character data into local data structure<commit_after>angular.module('AngularRails')
  .controller('CharacterCtrl', ['$scope', '$http', '$rootScope', function ($scope, $http, $rootScope) {
      $scope.bars = ["foo", "bar"];

      $scope.selectedPilot = "default";

      $scope.accountProfile = $rootScope.accountProfile;

      $scope.choosePilot = function() {
        console.log(">>> " + $scope.selectedPilot);
      };

      $scope.loadPilotData = function() {
        var keyID = $scope.accountProfile.keyID;
        var vcode = $scope.accountProfile.vcode;
        var characterID = $scope.accountProfile.characters[$scope.selectedPilot]["character_id"];
        $http({
          method: 'GET',
          url: 'https://api.eveonline.com/char/CharacterSheet.xml.aspx',
          params : {keyID:keyID, vcode:vcode, characterID:characterID},
          transformResponse: function(data) {
            // TODO: refactor into service
            var x2js = new X2JS({attributePrefix:"@"});
            var json = x2js.xml_str2json(data);

            var json_data = JSON.stringify(json).replace(/@/g, '');
            json = JSON.parse(json_data);

            return json;
          }
        })
            .success(function(data) {
              console.log(data);

              var serverCharData = data['eveapi']['result']
              var localCharData  = $scope.accountProfile.characters[$scope.selectedPilot];

              localCharData["dob"] = serverCharData["DoB"];
              localCharData["race"]= serverCharData["race"];
              localCharData["bloodline"] = serverCharData["bloodline"];
              localCharData["ancestry"] = serverCharData["ancestry"];
              localCharData["gender"] = serverCharData["gender"];
              localCharData["clone_name"] = serverCharData["cloneName"];
              localCharData["clone_skill_points"] = serverCharData["cloneSkillPoints"];
              localCharData["balance"] = serverCharData["balance"];

            });
      };
{'fraction_non_alphanumeric': 0.14915824915824916, 'fraction_numerical': 0.0013468013468013469, 'mean_word_length': 2.6187576126674785, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 3}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3014676', 'n_tokens_mistral': 860, 'n_tokens_neox': 827, 'n_words': 136}