Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Convert XML to JSON In Angular JS - SibeeshPassion </title>
- <script src="jquery-2.1.3.min.js"></script>
- <script src="angular.min.js"></script>
- <script src="xml2json.js"></script>
- </head>
- <body>
- <div ng-app="httpApp" ng-controller="httpController">
- <table cellspacing="30">
- <thead>
- <tr class="ligneTab">
- <th>CN Location SITE</th>
- </tr>
- </thead>
- <tbody>
- <tr ng-repeat="data in myData">
- <td>{{data}}</td>
- </tr>
- </tbody>
- <br>
- </table>
- </div>
- <script>
- var app = angular.module('httpApp', []);
- app.controller('httpController', function ($scope, $http) {
- $http.get("Sitemap3.xml",
- {
- transformResponse: function (cnv) {
- var x2js = new X2JS();
- var aftCnv = x2js.xml_str2json(cnv);
- return aftCnv;
- }
- })
- .then(function (response) {
- console.log(response);
- $scope.myData = response.data;
- });
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement