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>

Reply via email to