Hi all,
I have the following XML:
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <GetUserLinksResponse xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService"> <GetUserLinksResult> <QuickLinkData> <Name>Some Team Room</Name> <Group>My Team Rooms</Group> <Privacy>Public</Privacy> <Url>http://www.somewhere.com</Url> <ID>1</ID> </QuickLinkData> </GetUserLinksResult> </GetUserLinksResponse> </soap:Body> </soap:Envelope>
That I am getting in JQuery, using the following:
$().SPServices({ operation: "GetUserLinks", AccountName: accountName, completefunc: function (xData, Status) { console.log(xData); var soapResponse = xData.responseXML; //var jSonResponse = $(soapResponse).SPFilterNode("QuickLinkData").SPXmlToJson(); //self.MyQuickLinks(ko.wrap.toJS(jSonResponse)); $(xData.responseXML).find('QuickLinkData').each(function () { var url = $(this).find("Url").text(); var title = $(this).find("Name").text(); self.MyQuickLinks.push({ Title: title, URL: url }); }); } });Where xData.responseXML is the XML above. What I need to do is loop through the groups, then each link in each group. However, the XML isn't structured like that. Is there some "get unique <Group> elements", e.g. pseudo code what I need is:
- For each unique <Group>
-- Then for each <QuickLinkData> for that unique <Group>
Any help much appreciated.
Regards,
Ben