1

We have an XML file with the structure:

<people>
  <person>
   <name>David</name>
   <url>http://www.davidsurl.com</url>
  </person>
  <person>
   <name>Wendy</name>
   <url>http://www.wendysurl.com</url>
  </person>
</people>

When my AngularJS app loads we have the name attribute accessible. I want to check if the name exists within the XML feed and if so, return the url.

I have read through the following tutorial: http://motyar.blogspot.com.au/2014/08/how-to-parse-xml-in-angular-js.html, but I am still have issues parsing the XML structure.

I am stuck with the following controller and not sure where to head next.

   var peopleApp = angular.module('getPeopleApp', []);

 peopleApp.factory('peoplesApp', function ($http) {
     var people = [];

     function () {
         return $http.get("http://internalserver/people.xml");
     }

     return people;
 });
rlsaj
  • 735
  • 1
  • 12
  • 37

0 Answers0