I have a function that at the moment displays the hard-coded XML data in an iPhone app;\[code\] function viewXMLFiles() { xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", "TestInfo.xml", false); xmlhttp.send(); xmlDoc = xmlhttp.responseXML; document.getElementById("docname").innerHTML = xmlDoc.getElementsByTagName("document_name")[0].childNodes[0].nodeValue; document.getElementById("filetype").innerHTML = xmlDoc.getElementsByTagName("file_type")[0].childNodes[0].nodeValue; document.getElementById("fileloc").innerHTML = pathToRoot + "/" + document.getElementById("docname").innerHTML; document.getElementById("docname1").innerHTML = xmlDoc.getElementsByTagName("document_name")[1].childNodes[0].nodeValue; document.getElementById("filetype1").innerHTML = xmlDoc.getElementsByTagName("file_type")[1].childNodes[0].nodeValue; document.getElementById("fileloc1").innerHTML = pathToRoot + "/" + document.getElementById("docname1").innerHTML; }\[/code\]and i want to put it into a loop so when i add the option to upload files the file will automatically loop through and display the data when a button is clicked instead of having to change the code. the button is coded as such;\[code\]<button onclick = "viewXMLFiles(); document.getElementById('showDocumentLink').style.display = 'block';">View Document Info</button><br>\[/code\]and the page is set out as such to load the XML into it;\[code\] <div id = "doclist"> <h2>Document 1;</h2> <label>Document Name;</label><br><span id = "docname"></span><br> <label>File Type</label><br><span id = "filetype"></span><br> <label>File Location</label><br><span id = "fileloc"></span><br> </div> <div id = "doclist"> <h2>Document 2;</h2> <label>Document Name;</label><br><span id = "docname1"></span><br> <label>File Type</label><br><span id = "filetype1"></span><br> <label>File Location</label><br><span id = "fileloc1"></span><br> </div>\[/code\]I'm really new to XML files and how to Parse them using JavaScript, so any help in showing me how to put them correctly into a \[code\]for\[/code\] loop would be great. I don't really have an idea of how to do it, so any help at all would be much appreciated. Thanks in advance