# Nested loop problem

**URL:** <https://forum.kirupa.com/t/nested-loop-problem/218054>\
**Category:** Uncategorized\
**Created:** [March 4, 2007, 6:05pm UTC](https://forum.kirupa.com/t/nested-loop-problem/218054 "2007-03-04T18:05:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rodrigobellao](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@rodrigobellao](https://forum.kirupa.com/u/rodrigobellao)\
**Post date:** [March 4, 2007, 6:05pm UTC](https://forum.kirupa.com/t/nested-loop-problem/218054/1 "2007-03-04T18:05:33Z")

</div>

Hi there, i´m having problems with a nested loop. i found some post here, but they didn´t help me. i need to extract the individual values from a nested xml node. i simplyfied the xml.  
this is the code:

\<base\>  
[INDENT]\<jobs\>  
[INDENT]\<prints\>  
[COLOR=Red]\<print\>1.jpg\</print\>[/COLOR]  
[COLOR=Red]\<print\>2.jpg\</print\>[/COLOR]  
[COLOR=Red]\<print\>3.jpg\</print\>[/COLOR]  
\</prints\>  
[/INDENT]\</jobs\>  
[/INDENT][INDENT]\<jobs\>  
[/INDENT][INDENT][INDENT]\<prints\>  
[COLOR=Red]\<print\>1.jpg\</print\>[/COLOR]  
[COLOR=Red]\<print\>2.jpg\</print\>[/COLOR]  
[COLOR=Red]\<print\>3.jpg\</print\>[/COLOR]  
\</prints\>  
[/INDENT] \</jobs\>  
[/INDENT]…etc

I need the prints node, but a i need to acess this one by one. by now i only got an entire array.

this is my as:  
xml\_prints.onLoad = function(ok) {  
if (ok) {  
var prints = xml\_prints.firstChild.childNodes;  
for (var p = 0; p\<prints.length; p++) {  
var print = prints[p];  
var jobs = print.firstChild.childNodes;  
for (var s = 0; s\<jobs.length; s++) {  
var job = jobs[s];  
}  
}  
}  
};

the var job contain all the elements, but a i didn´t figure how to take this one by one like job[0], job[2]

thanks for the help
