Small Tweaks, less lines of code. Still no major breaks in breaking the nested model for XML parsing. Things that I am interested in are being able to determine levels of nesting abstractly, being able to determine attributes abstractly, being able to hold results in an Array, build the array, and then append the array.
function parseXml(xml) { $(xml).find('sites').each(function(){ $(this).find('>element').each(function(){ var PARENT = $(this); var siteBLOCK = $("div").append(PARENT.attr("label") +' '+ PARENT.attr("id") + "<br/>" ); $(PARENT).find('>element').each(function(){ var THISis = $(this); siteBLOCK = $("div").append(THISis.attr('label') +": Has a latitude of "+ PARENT.attr('lat') +" and a longitude of "+ PARENT.attr ('lng') + "<br/>" ); $(THISis).find('>element').each(function(){ var thisCHILD = $(this); siteBLOCK = $("div").append(thisCHILD.attr('label') +": " + thisCHILD.text() + "<br/>"); }); }); }); }); } });