how can i traverse an xml file using ajax faster/more efficiently?

mathewalmond

New Member
i have an xml file that looks like the following:\[code\]<UUT><DKBFile>091750</DKBFile><part> <name>FL_U1</name> <xcoord>439</xcoord> <ycoord>132</ycoord> <width>55</width> <height>24</height></part></UUT>\[/code\]that may have a few hundred "Parts" that i'm trying to get name/coordinate info for. The amount, and the parts i'm getting information for, changes, but the traversing gets VERY slow once i'm trying to get this information for over 100 parts. Here's my code:\[code\]$.ajax({url: "PROFILER_ShopAid/shopaid.xml",dataType: ($.browser.msie) ? "xml" : "text/xml",success: function(data){ var i = 1; //array traversalvar xcoord = 0;var ycoord = 0;var width = 0;var height = 0;var part = "";var nameFound = "";//Get Part Countvar covCnt = DKB.GetClearedPartCnt(); //Gets number of parts //Get Part Infowhile (covCnt >= i){ part = DKB.GetClearedPart(i); //Returns name of part $(data).find("part").each(function() { nameFound = $(this).find("name").text(); if(part.toLowerCase() == nameFound.toLowerCase()) { xcoord = parseInt( $(this).find("xcoord").text() ); ycoord = parseInt( $(this).find("ycoord").text() ); width = parseInt( $(this).find("width").text() ); height = parseInt($(this).find("height").text() ); } }); i = i + 1;}},error: function(){}}); \[/code\]The xml file is on a local server, this code is being used in an HTA (HTML Application file). Is there a more efficient way to go about traversing the xml file? right now, it takes about 15-20 seconds to get the information for ~150 parts. i've timed the queries i'm making to get the part count/part names (i commented out the AJAX code), and those are under 200ms for large part counts. any help would be greatly appreciated!
 
Back
Top