>- see footer for list info -<
Where is the original xml object stored is it in the application scope.

Or if the "member" variable is not scoped and is in a persisted component
same problem ?

Also XML docs are accessed by reference rather than by value.

Is this called in a function is the variable "vared" ?

Could it be possible that in between the arraylen statement and the loop the
data is changing.

Try setting the arrayLen(member.xmlData.blog.entry) - 1 into a variable
first otherwise it gets reevaluated on each iteration.

Also in this case if you are only wanting to do something based on a certain
node value you could do this in xpath rather than using cf to do the search.

My 2p

Alex


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dominic Watson
Sent: 08 September 2006 13:04
To: Coldfusion Development
Subject: Re: [CF-Dev] Error looping an array

>- see footer for list info -<
This is the thing, the error does not reproduce itself, it happens randomly
0.5% of the time - reloading the same request that caused the error doesn't
create the error again. I guess I will have to ignore it - but it must
happen for a logical reason right?!

Looping to arrayLen - 1 would miss the last element, I can't do that.


On 08/09/06, RichL <[EMAIL PROTECTED]> wrote:
>
> >- see footer for list info -<
> <cfif structKeyExists(member.xmlData.blog, 'entry')>
>   <cfloop from="1" to="#arrayLen(member.xmlData.blog.entry) - 1#"
> index="i">
>       <cfif member.xmlData.blog.entry[i].id.xmlText EQ iID>
>             <!---- stuff --->
>       </cfif>
>   </cfloop>
> </cfif>
>
> could you try looping to arraylen - 1 if that seems to be happening?
>
>
> On 9/8/06, Adrian Lynch <[EMAIL PROTECTED]> wrote:
> > >- see footer for list info -<
> > Get busy with outputting values I reckon.
> >
> > Ade
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] Behalf Of Dominic Watson
> > Sent: 08 September 2006 12:36
> > To: Coldfusion Development
> > Subject: Re: [CF-Dev] Error looping an array
> >
> >
> > >- see footer for list info -<
> > Oh woops, the code in question uses EQ not =.
> >
> > The array is actually in the application scope (don't ask) and is a node
> in
> > an xmlObject. I have just realised that I have not been using cflock
> when
> > using the application variable, am doing so now - could this be it?
> >
> > The actual code:
> >
> > <cfif structKeyExists(member.xmlData.blog, 'entry')>
> >    <cfloop from="1" to="#arrayLen(member.xmlData.blog.entry)#"
> index="i">
> >        <cfif member.xmlData.blog.entry[i].id.xmlText EQ iID>
> >              <!---- stuff --->
> >        </cfif>
> >    </cfloop>
> > </cfif>
> >
> > The error definately refers to the entry node and the element that the
> app
> > is trying to get at is always one more than there are (if there were 20
> > elements, it would have been looking at 21).
> >
> > Dom
> > _______________________________________________
> >
> > For details on ALL mailing lists and for joining or leaving lists, go to
> http://list.cfdeveloper.co.uk/mailman/listinfo
> >
> > --
> > CFDeveloper Sponsors:-
> > >- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
> > >- Lists hosted by www.Gradwell.com -<
> > >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help
> -<
> >
>
>
> --
> Rich
> _______________________________________________
>
> For details on ALL mailing lists and for joining or leaving lists, go to
> http://list.cfdeveloper.co.uk/mailman/listinfo
>
> --
> CFDeveloper Sponsors:-
> >- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
> >- Lists hosted by www.Gradwell.com -<
> >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help
> -<
>



-- 
Blog it up: http://blog.dominicwatson.co.uk
_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<


_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to