Ok I'm grabbing data from YouTube and got down to extracting an element 
below/inside the
root element.  Just can't figure out how to grab the view_count child element 
in the following 
XML example. See CF code after xml sample code. Any direction would be great

Thank you all so very much!

XML SAMPLE:
<?xml version="1.0" encoding="utf-8" ?> 
<ut_response status="ok">
<video_details>
  <author>ShiftShoutOut</author> 
  <title>Shift shout out 18</title> 
  <rating_avg>4.78</rating_avg> 
  <rating_count>9</rating_count> 
  <tags>Shift shout out</tags> 
  <description>Shift shout out</description> 
  <update_time>1179219506</update_time> 
  <view_count>1293</view_count> 
  <comment_count>7</comment_count> 
  <upload_time>1175256758</upload_time> 
  <length_seconds>188</length_seconds> 
  <recording_date /> 
  <recording_location /> 
  <recording_country /> 
 <comment_list>
 <comment>
  <author>soccer940</author> 
  <text>This is an incredible song!</text> 
  <time>1175571559</time> 
  </comment>
 <comment>
  <author>whosscruffylookin</author> 
  <text>i'm buying breath mints</text> 
  <time>1175574660</time> 
  </comment>
 <comment>
  <author>34dd1227</author> 
  <text>amazing song... i do believe this planet is saved if we follow his 
plan.</text> 
  <time>1175612508</time> 
  </comment>
 <comment>
  <author>felicitous12</author> 
  <text>haha i loved it!</text> 
  <time>1175616510</time> 
  </comment>
 <comment>
  <author>dubulOkotus</author> 
  <text>Excellent. Excellent to say the least --> but next time, I want to see 
Julie humping back.</text> 
  <time>1175622481</time> 
  </comment>
 <comment>
  <author>cshrewman</author> 
  <text>TK rocks me socks off!</text> 
  <time>1175650533</time> 
  </comment>
 <comment>
  <author>willte86</author> 
  <text>Awesome, I love it</text> 
  <time>1177548178</time> 
  </comment>
  </comment_list>
 <channel_list>
  <channel>Film & Animation</channel> 
  </channel_list>
  <thumbnail_url>http://img.youtube.com/vi/1fRzsbUfyTk/2.jpg</thumbnail_url> 
  <embed_status>ok</embed_status> 
  </video_details>
  </ut_response>


CF CODE: ( all inside a cfoutput queryname="rstCurVideo" )

rstCurVideo.YouTube_vidID# is equal to the YouTube video ID that needs to be 
dynamically passed

<!--- IMPORT XML CODE FROM YOUTUBE --->
<!--- 1. Fetch XML content via HTTP, as if you were a browser --->
<CFHTTP
METHOD="GET"
URL=http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=PWYt6CtKPOA&video_id=#rstCurVideo.YouTube_vidID#>
<!--- 2. Set XML content to string variable called MyXmlCode --->
<CFSET MyXmlCode = CFHTTP.FileContent>
<!--- 3. Parse the XML into an XML "Object" --->
<!--- (very similar to a CFML Structure) --->
<CFSET MyXml = XmlParse(MyXmlCode)>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & 
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:278645
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