Michael,

What I'm seeing is that your query only has one row. I took your code and 
applied

<cfoutput>#xmlsize# #xmlqry.recordcount#</cfoutput>

to see that those values were. #xmlsize# is 1, as well as #xmlqry.recordCount#. 
I'd suggest taking a look at the way you've built your array or even writing 
the contents of #cfhttp.filecontent# to a file and inspect the return from your 
remote host. It looks like all other code is correct.

Hope that's helpful.


From: ad...@acfug.org [mailto:ad...@acfug.org] On Behalf Of Michael Brown
Sent: Saturday, January 15, 2011 10:58 AM
To: discussion@acfug.org
Subject: [ACFUG Discuss] XML Question

Hey folks,

Stuck on trying to get an XML query to display more than one record.  Can't 
figure out what I'm doing wrong.  There are 5 records in the file. The code is 
listed below, any suggestions would be helpful.

Thanks

<cfhttp 
url="http://merchandising.expediaaffiliate.com/campaign/?campaignId=5409&cid=311009";
 method="GET">

<cfscript>
    xmlfile = xmlparse(cfhttp.filecontent); //Parses the XML
    xmlsize = arraylen(xmlfile.HotelAvailabilityListResults); 
//HotelAvailabilityListResults is the parent tree
    xmlqry = QueryNew("Hotelid, name, city, promodescription, valueadds, 
displayroomrate"); //Sets a query for output
    QueryAddRow(xmlqry,xmlsize);

    for(a=1;a LTE xmlsize;a=a+1) {
            
//QuerySetCell(xmlqry,"hotelid",xmlfile.HotelAvailabilityListResults.hotel[a].xmlAttributes.hotelid,a);
        
//QuerySetCell(xmlqry,"hotelid",xmlfile.HotelAvailabilityListResults.hotel[a].hotelid.xmlText,a);
        //xmlfile.Tutorials.TutorialID[a].Title.xmlText gets the text of the 
title for the current tutorial (xmlText)
        
QuerySetCell(xmlqry,"name",xmlfile.HotelAvailabilityListResults.hotel[a].name.xmlText,a);
        
QuerySetCell(xmlqry,"city",xmlfile.HotelAvailabilityListResults.hotel[a].city.xmlText,a);
        
QuerySetCell(xmlqry,"promodescription",xmlfile.HotelAvailabilityListResults.hotel.HotelProperty[a].promodescription.xmlText,a);
        
QuerySetCell(xmlqry,"valueadds",xmlfile.HotelAvailabilityListResults.hotel.HotelProperty[a].valueadds.xmlText,a);
        
//QuerySetCell(xmlqry,"displayroomrate",xmlfile.HotelAvailabilityListResults.hotel.HotelProperty[a].xmlAttributes.id,a);
        //xmlfile.Tutorials.TutorialID[a].xmlAttributes.id gets the value of 
the attribute in the tag
    }
</cfscript>

<cfquery name="tutorials" dbtype="query">
    SELECT        *
    FROM           xmlqry
    ORDER BY     hotelid DESC
</cfquery>


<cfoutput query="tutorials">
  #name# #promodescription#
    <br><br>
</cfoutput>
________________________________

No virus found in this message.
Checked by AVG - www.avg.com<http://www.avg.com>
Version: 10.0.1191 / Virus Database: 1435/3380 - Release Date: 01/14/11



-------------------------------------------------------------

To unsubscribe from this list, manage your profile @ 

http://www.acfug.org?fa=login.edituserform



For more info, see http://www.acfug.org/mailinglists

Archive @ http://www.mail-archive.com/discussion%40acfug.org/

List hosted by http://www.fusionlink.com

-------------------------------------------------------------


Reply via email to