On Tue, Nov 25, 2008 at 6:31 AM, daniel kessler <[EMAIL PROTECTED]> wrote:
>>Hi Daniel,
>>
>>Yes you'll need to loop through and append them to a string if you are
>>trying to save them to one query record. What does the entire xml file look,
>>I assume that previous piece of code is just one of the entries?
>>
>
> Thing is, I don't know how many of them there are, or rather I don't know how 
> to determine how many 'category' entries there are, so I can't loop through 
> them.  I don't want to repeat information in a second post, so if you check 
> out my earlier post, I describe my current quandry 
> (http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:57962#314699)
>

You might want to look into XPath queries using the XMLSearch
function, that's how I did it.
Here's my code to get and loop through the categories:

<cfsavecontent variable="xml"><?xml version="1.0" encoding="utf-8"?>
<entry>
               <id>
tag:blogger.com,1999:blog-1550840680584738668.post-851696689458182282
               </id>
               <published>
2008-10-29T09:49:00.002-04:00
               </published>
               <updated>
2008-10-29T09:56:21.122-04:00
               </updated>
               <category scheme='http://www.blogger.com/atom/ns#'
term='What are you doing?'/>
               <category scheme='http://www.blogger.com/atom/ns#'
term='Health in the News'/>
               <title type='text'>
Family Election Guide with Dr. Elaine Anderson
               </title>
</entry>
</cfsavecontent>

<cfscript>
        xml = XMLParse(xml);
        categories = XMLSearch(xml, "/entry/category");
        total_categories = ArrayLen(categories);
</cfscript>

<!--- <cfdump var="#xml#">
<cfdump var="#categories#"> --->
<cfoutput>
<cfloop index="currentitem" from="1" to="#total_categories#">
        #categories[currentitem].XMLAttributes.term#<br />
</cfloop>
</cfoutput>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:315889
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to