RE: xml woes
I've been following what you guys have been doing... Can you post the final code when you get it figured out? Thanks! Peter -Original Message- From: Robby L. [mailto:[EMAIL PROTECTED]] Sent: Monday, February 17, 2003 11:28 PM To: CF-Talk Subject: xml woes Importance: High 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=215 87&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 : a b c d e 1 2 3 4 5 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); yes = dropx.drop[i].xmlchildren; yes = dropx.drop[i].xmlchildren; arraydeleteat(yes, j);/*when this is in, returns the error, without it everything runs fine*/ I've also tried ...: With using the xpath syntax (set in the upper cfscript) arraydeleteat(tt, i);/*when this is in, returns the error, without it everything runs fine*/ 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 Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: xml woes
> Then as the loop continues on > to the 6th item, (which no longer exists - you deleted it) the > server throws an exception. ...and by 6th item I meant 5th... :) -Cameron - Cameron Childress Sumo Consulting Inc. --- cell: 678-637-5072 aim: cameroncf email: [EMAIL PROTECTED] > -Original Message- > From: Cameron Childress [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 18, 2003 2:10 AM > To: CF-Talk > Subject: RE: xml woes > > > If I understand your question, you aren't having XML woes, you are having > ArrayDeleteAt() woes. > > My first bit of advice when troubleshooting a problem like this > would be to > simplify your code. Breaking a complex problem down into smaller pieces > allows you to focus on the part that's breaking without being > distracted by > the other stuff (like the fact that you were using XML to generate your > array). Also, in a related note - you've posted a gigantic amount of code > into this email, and few people on the list are likely to be willing to go > through it line by line and figure out everything it's doing. That's just > free unsolicited advice, though it doesn't directly solve the problem at > hand. > > I think your problem is a pretty basic one. Essentially, you are > doing this > at the end of your code: > > > > > > > > Looks to me like the problem is that when your array's length is evaluated > at the beginning of the loop it's "5", but as soon as the cfif returns a > match, you end up deleting an item from the array. This > effectively changes > the array's length *immediately* to 4 items. Then as the loop > continues on > to the 6th item, (which no longer exists - you deleted it) the > server throws > an exception. > > The java.lang.IndexOutOfBoundsException is saying that your index > 5 is "out > of bounds" because your array's only got 4 items in it. > > Hope that helps! > > -Cameron > > - > Cameron Childress > Sumo Consulting Inc. > --- > cell: 678-637-5072 > aim: cameroncf > email: [EMAIL PROTECTED] > > > > -Original Message- > > From: Robby L. [mailto:[EMAIL PROTECTED]] > > Sent: Monday, February 17, 2003 11:28 PM > > To: CF-Talk > > Subject: xml woes > > > > > > 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&th > > readid=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 : > > > > > > a > > b > > c > > d > > e > > > > > > 1 > > 2 > > 3 > > 4 > > 5 > > > > > > > > > variable="xmlmy"> > > > > 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); > > > > > > > > > > > > > > > > > > yes = dropx.drop[i].xmlchildren; > > > > > > > > > >> index="j"> > > > > > > yes = dropx.drop[i].xmlchildr
RE: xml woes
If I understand your question, you aren't having XML woes, you are having ArrayDeleteAt() woes. My first bit of advice when troubleshooting a problem like this would be to simplify your code. Breaking a complex problem down into smaller pieces allows you to focus on the part that's breaking without being distracted by the other stuff (like the fact that you were using XML to generate your array). Also, in a related note - you've posted a gigantic amount of code into this email, and few people on the list are likely to be willing to go through it line by line and figure out everything it's doing. That's just free unsolicited advice, though it doesn't directly solve the problem at hand. I think your problem is a pretty basic one. Essentially, you are doing this at the end of your code: Looks to me like the problem is that when your array's length is evaluated at the beginning of the loop it's "5", but as soon as the cfif returns a match, you end up deleting an item from the array. This effectively changes the array's length *immediately* to 4 items. Then as the loop continues on to the 6th item, (which no longer exists - you deleted it) the server throws an exception. The java.lang.IndexOutOfBoundsException is saying that your index 5 is "out of bounds" because your array's only got 4 items in it. Hope that helps! -Cameron - Cameron Childress Sumo Consulting Inc. --- cell: 678-637-5072 aim: cameroncf email: [EMAIL PROTECTED] > -Original Message- > From: Robby L. [mailto:[EMAIL PROTECTED]] > Sent: Monday, February 17, 2003 11:28 PM > To: CF-Talk > Subject: xml woes > > > 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&th > readid=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 : > > > a > b > c > d > e > > > 1 > 2 > 3 > 4 > 5 > > > > variable="xmlmy"> > > 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); > > > > > > > > > yes = dropx.drop[i].xmlchildren; > > > > > index="j"> > > > yes = dropx.drop[i].xmlchildren; > > > > > > > > > > > arraydeleteat(yes, j);/*when this is in, returns the > error, without it everything runs fine*/ > > > > > > > > I've also tried ...: With using the xpath syntax (set in the upper > cfscript) > > > > > > > arraydeleteat(tt, i);/*when this is in, > returns the error, without it > everything runs fine*/ > > > > > 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 > > > > > ~~
RE: xml woes
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 : a b c d e 1 2 3 4 5 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); yes = dropx.drop[i].xmlchildren; yes = dropx.drop[i].xmlchildren; arraydeleteat(yes, j);/*when this is in, returns the error, without it everything runs fine*/ I've also tried ...: With using the xpath syntax (set in the upper cfscript) arraydeleteat(tt, i);/*when this is in, returns the error, without it everything runs fine*/ 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 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: xml woes
Robby, I suspect this is probably a typo, but the closing tag of your xml packet isn't a closing tag. > 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. > Basically, this means that CF is trying to access a element in an array, past the end of the array. eg. there are 2 elements in the array and you are trying to access the third element. Looking at your code. The reason for this is that you are using the "yes" variable to store an array in both your outer "i" loop and your inner "j" loop. You need to use different variables for each loop, otherwise you'll be overwriting your outer array everytime you go around your inner array. Also, I suspect that you are trying to delete the wrong bit of your array. You need to be Try this : (I warn you there maybe errors. I typed this from your code and off the top of my head without testing it) // Loop over the children of c_dropx eg. and for (i=1; i lte arraylen(c_dropx); i=i+1) { // bung the structure for the current element into a new variable for ease thisElement = StructNew(); thisElement = c_dropx[i]; // Check the attributes of thisElement to see it is abba. if (thisElement.xmlattributes["name"] is "abba") // Loop over the children for thisElement, which would be the same as looping over the elements for (j=1;j lte arraylen(thisElement.xmlChildren); j=j+1) { // Store the current child structure in a variable thisChild for ease thisChild = StructNew(); thisChild = thisElement.xmlchildren[j]; if (thisChild.xmltext is "a") { WriteOutput(j&" - "&thisChild.xmltext&""); arraydeleteat(thisElement.xmlchildren, j); } } } > 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? To be honest, I'm not sure what's up with your second bit of code. I really need to play with xml in CFMX some more, but here's the cfscript version of your code. I suspect, that you have the same problem here as you do above, where you are trying to delete the array from the wrong place in the data structure. for (i=1;i lte arraylen(tt); i=i+1) { if (tt[i].xmltext is "a") { arraydeleteat(tt, i); } } Hope some of this helps some how. Regards Stephen ~| 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 Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4