Ben Densmore 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]
