Software Squirrel
asked on
Get Node Values from SharePoint List
I was show how to access the responsXML once for my list. I am trying figure out how to get to the nodes again. The last time I did it, it was with Chrome Developer tools in the browser.
I have a function like this:
I have a function like this:
function myFunction(responseXML) {
console.log(responseXML);
var itemList = [];
console.log(responseXML.getElementsByTagName("entry"));
for (var i = 0; i < responseXML.getElementsByTagName("entry").length; i++) {
id = responseXML.getElementsByTagName("entry")[i].childNodes[0].childNodes[0].nodeValue;
title = responseXML.getElementsByTagName("entry")[i].childNodes[20].childNodes[0].childNodes[5].childNodes[0].nodeValue;
header = responseXML.getElementsByTagName("entry")[i].childNodes[20].childNodes[0].childNodes[7].childNodes[0].nodeValue;
urlDescription = responseXML.getElementsByTagName("entry")[i].childNodes[20].childNodes[0].childNodes[8].childNodes[0].childNodes[0].nodeValue;
url = responseXML.getElementsByTagName("entry")[i].childNodes[20].childNodes[0].childNodes[8].childNodes[1].childNodes[0].nodeValue;
methodType = responseXML.getElementsByTagName("entry")[i].childNodes[20].childNodes[0].childNodes[9].childNodes[0].nodeValue;
itemList.push(new Item(id, header, title, url, urlDescription, methodType));
}
if you are using jQuery also then you can use below samples:
var AllMemberNodes = $(xml).find('<NodeNameHere >');
Then you can loop like:
var allAttributes = AllMemberNodes[0].attribut es.length;
for (var a = 0; a < allAttributes; a++)
{
AllMemberNodes[0].attribut es[a].valu e;
}
Hope this logic helps you.
var AllMemberNodes = $(xml).find('<NodeNameHere
Then you can loop like:
var allAttributes = AllMemberNodes[0].attribut
for (var a = 0; a < allAttributes; a++)
{
AllMemberNodes[0].attribut
}
Hope this logic helps you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It would be very helpful if you share value of 'responseXML' you are referring.