ummm? I am, .. xmlsearch and xmlparse is being used in the cfscript block, and the issue is still ongoing.. Thanks though, Robby
Subject: xml woes From: "Peter Bagnato" <[EMAIL PROTECTED]> Date: Mon, 17 Feb 2003 13:42:47 -0500 Thread: http://www.houseoffusion.com/cf_lists/index.cfm?method=messages&threadid=21587&forumid=4#108995 Have you tried using any of the new XML tags in CFMX yet? Peter -----Original Message----- From: Robby L. [mailto:[EMAIL PROTECTED]] Sent: Monday, February 17, 2003 5:36 AM To: CF-Talk Subject: xml woes Importance: High I'm writing in hopes to see what I'm doing wrong when trying to manipulate an xml doc. The problems comes with deleting, and I'm running in loads of problems. an example of the xml doc : <dropdowns> <drop name="abba"> <drop_item>a</drop_item> <drop_item>b</drop_item> <drop_item>c</drop_item> <drop_item>d</drop_item> <drop_item>e</drop_item> </drop> <drop name="1221"> <drop_item>1</drop_item> <drop_item>2</drop_item> <drop_item>3</drop_item> <drop_item>4</drop_item> <drop_item>5</drop_item> </drop> <dropdowns> <!--- reading page ---> <cffile action="read" file="C:\CFusionMX\wwwroot\Mathmotors\drop.xml" variable="xmlmy"> <cfscript> drop = xmlparse(xmlmy);//xml thats parsed. dropx = drop.xmlroot;// The xml root. c_dropx = dropx.xmlchildren;// Gets the array for all of the drop down groups. count_c_dropx = arraylen(c_dropx);// Gets the count of arrays,(dropdowns.drop) Needed for a loop. hmm ="abba";// fake variable tt = xmlsearch(dropx,"/dropdowns/drop[@name='#hmm#']/drop_item/"); /* The Search (returns an array, which will give me the info for the dropdown)*/ toto = arraylen(tt); </cfscript> <!--- One way I've tried ---> <cfoutput> <!--- Loop through the "drop" elements---> <cfloop from="1" to="#arraylen(c_dropx)#" index="i"> <!--- Set the dropchildren to a variable to be able to loop over---> <cfscript> yes = dropx.drop[i].xmlchildren; </cfscript> <!--- Where the drop name's attribute equals "abba" then I can edit down the tree ---> <cfif dropx.drop[i].xmlattributes["name"] is "abba"> <!--- Loop over the yes value, which would be the same as looping over the <drop_item> elements ---> <cfloop from="1" to="#arraylen(yes)#" index="j"> <!--- Set the dropchildren to a variable to be able to loop over---> <cfscript> yes = dropx.drop[i].xmlchildren; </cfscript> <!--- WHere the <dropelement>'s text equals "a" delete that element @ it's index ---> <cfif yes[j].xmltext is "a"> <cfdump var="#j#"> <!--- Dumps ok, .. returns the postition of audi---> <cfdump var="#yes#"> <!--- Dumps ok, .. returns the array needed ---> <cfscript> arraydeleteat(yes, j);/*when this is in, returns the error, without it everything runs fine*/ </cfscript> </cfif> </cfloop> </cfif> </cfloop> </cfoutput> I've also tried ...: With using the xpath syntax (set in the upper cfscript) <cfoutput> <cfloop from="1" to="#arraylen(tt)#" index="i"> <cfif #tt[i].xmltext# is "a"> <cfscript> arraydeleteat(tt, i);/*when this is in, returns the error, without it everything runs fine*/ </cfscript> </cfif> </cfloop> </cfoutput> Both of which bail.. the first one bails without an actual error, . just the araydeleteat() being the line it error'd at. But when I looked in to the logs, It says java.lang.IndexOutOfBoundsException and searching google only gave two results, . both of which have no bearing on the situation at hand. The element at position 5 of dimension 1, of array variable "TT," cannot be found is the one on the second try, and with it, the array itself is cfdumped, and there is 5 elements in the array ,I've read the docs I've double checked what I know how. What the hell am I doing wrong? Thanks for your help Robby ps I do have updater 2 installed if it has any bearing ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4