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)

<cfscript>
// Loop over the children of c_dropx eg. <drop name="abba"> and <drop
name="1221">
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 <drop_item> 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&"<BR>");
        arraydeleteat(thisElement.xmlchildren, j);
   }
  }
}
</cfscript>


> 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.

<cfscript>
for (i=1;i lte arraylen(tt); i=i+1) {
   if (tt[i].xmltext is "a") {
      arraydeleteat(tt, i);
   }
}
</cfscript>

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
                                

Reply via email to