Why do you xmlparse and then convert it back to a string? It was a string originally. Just save cfhttp.filecontent. Actually, cfhttp supports saving it immediately.
On Wed, Jan 4, 2012 at 11:15 AM, Rick Faircloth <[email protected]> wrote: > > In trying to achieve step number 1, I tried to create a document > on my hard drive. Should this code not create an xml document > on my e: drive? > > <cfscript> > > URLToPull = 'http://lennox.com/api/v1/z7RRSHM/categories/'; > > </cfscript> > > <cfhttp url = '#URLToPull#' > method = 'get' > timeout = '60' > > > </cfhttp> > > <cfset myXMLDocument = XmlParse(cfhttp.fileContent)> > <cfset myXMLDocument = toString(myXMLDocument)> > > <cffile action="write" file="e:\temp\myxmldoc.xml" > output="#myXMLDocument#"> > > > > -----Original Message----- > From: Dave Watts [mailto:[email protected]] > Sent: Wednesday, January 04, 2012 10:52 AM > To: cf-talk > Subject: Re: Is what I'm trying to do with XML even possible? > > >> Is this even possible given the way the info is provided? >> In order to get that kind of looping over each category and >> product list, do I need to turn to putting the info into a >> database first? Or is there a way using the cfhttp statements >> that vendor is providing? > > Yes, it's definitely possible. However, you probably don't want to do > it all at runtime, if information doesn't change that frequently. For > example, I doubt that the categories change every day. > > So, here's what I'd do. > > 1. Fetch the XML files periodically, based on their Last-Modified date > if they have one. > 2. Read the Categories XML file as an XML document, then use > /Categories/Category as an XPath query to find your Category nodeset - > you should then be able to loop over that. > 3. For each category ID attribute, read the appropriate Product XML > file as an XML document, then use the XPath query > /Products/SubCategory/Product (or maybe just //Product, since I guess > it's possible that not all products have subcategories) - this again > will return a nodeset that you can loop over. > 4. Display stuff. > > Dave Watts, CTO, Fig Leaf Software > http://www.figleaf.com/ > http://training.figleaf.com/ > > Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on > GSA Schedule, and provides the highest caliber vendor-authorized > instruction at our training centers, online, or onsite. > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349310 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

