Subj : E4X for-each is eager To : netscape.public.mozilla.jseng From : McKinley, Richard Date : Fri Aug 20 2004 02:06 pm I was hoping that for-each would be lazy, but that was wishfull thinking. I as taking a parent-child relationship in a flat database table and converting it to nested XML. I wanted for-each to pick up new elements as they were added. How can I keep my place otherwise? I can store the last processed node, but how will I query for that node and its younger companions? var firstClient = sql.firstClient.toString().replace("!", "555"); var stmtClient = conn.createStatement(); var rsClient = stmtClient.executeQuery(firstClient); clients = ; while(rsClient.next()) { clients.client += ; } for each(c in clients..client) { var subsequentClient = sql.subsequentClient.toString().replace("!", c.@id.toString()); rsClient = stmtClient.executeQuery(subsequentClient); while(rsClient.next()) { c.client += ; } } out.write(clients); Thanks, McKinley .