Ben,

Your loop is over writing the previous values I assume. You can use
listappend function like this before returning

<cfset eventTitle = "">
<cfloop from="1"
to="#ArrayLen(variables.calEvents.events.XmlChildren)#"
index="evntTitle">
                 <cfset eventTitle = listappend(
eventTitle ,variables.calEvents.events.event[evntTitle].XmlAttributes.title) />
                 </cfloop>

Hope it helps

Qasim
On Tue, 13 Jul 2004 11:45:07 -0400, Ben Densmore <[EMAIL PROTECTED]> wrote:
> I'm reading in an XML file and trying to output some of the data. If I
> do a loop in the cfc and try to output it to a page I am only getting
> one value returned instead of all 7. I'm guessing because my cfreturn is
> outside of the loop but I can't seem to get it to display. The code in
> my cfc looks like:
> 
> <cfcomponent>
>        <cffunction access="public" name="readAll" output="false"
> returntype="string">
>                <cffile action="read"
> file="C:\cfusionMX\wwwroot\SparkEventsCalendar_loadXml.xml"
> variable="event">
>        <cfset variables.calEvents = XmlParse(event)>
>          <cfloop from="1"
> to="#ArrayLen(variables.calEvents.events.XmlChildren)#"
> index="evntTitle">
>                  <cfset eventTitle =
> variables.calEvents.events.event[evntTitle].XmlAttributes.title />
>                  </cfloop>
>                <cfreturn eventTitle />
>        </cffunction>
> </cfcomponent>
> 
> Then I'm doing:
> <cfset variables.events = createObject("component", "events").readAll()
> />
> 
> <cfoutput>#variables.events#</cfoutput>
> 
> Thanks,
> Ben
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
> in the message of the email.
> 
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
> 
> An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
>
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to