homepage Welcome to WebmasterWorld Guest from 23.20.28.193
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

    
accessing xml nodes in asp
musicales




msg:3560812
 12:55 pm on Jan 29, 2008 (gmt 0)

I'm trying to use the new youtube api, but I'm struggling in classic asp and can't see any tutorials online. I'm able to use XMLHTTP to get the xml into an objXML and have managed to confirm it is there OK.

Now all I need to get me started is how to access each 'entry' in the xml list. In my old code it worked like this:

totProds = objXML.getElementsByTagName("feed").length

and I would then find

for i=0 to totProds-1
a=objXML.getElementsByTagName("entry").item(i)
next

to find my way through the list. But totProds just returns 0 length.

I'll post a bit of the xml below, any help much appreciated.


<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:media='http://search.yahoo.com/mrss/' xmlns:gd='http://schemas.google.com/g/2005' xmlns:yt='http://gdata.youtube.com/schemas/2007'>
<id>http://gdata.youtube.com/feeds/videos</id>
<updated>2007-09-10T06:39:24.036Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind' term='http://gdata.youtube.com/schemas/2007#video'/>
<title type='text'>YouTube Videos matching query: google</title>
<logo>http://www.youtube.com/img/pic_youtubelogo_123x63.gif</logo>
<link rel='alternate' type='text/html' href='http://www.youtube.com'/>
<link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://gdata.youtube.com/feeds/videos'/>
<link rel='self' type='application/atom+xml' href='http://gdata.youtube.com/feeds/videos?start-index=1&amp;max-results=25&amp;vq=google'/>
<link rel='next' type='application/atom+xml' href='http://gdata.youtube.com/feeds/videos?start-index=26&amp;max-results=25&amp;vq=google'/>
<author>
<name>YouTube</name>
<uri>http://www.youtube.com/</uri>
</author>
<generator version='beta' uri='http://gdata.youtube.com/'>YouTube data API</generator>
<openSearch:totalResults>205908</openSearch:totalResults>
<openSearch:startIndex>1</openSearch:startIndex>
<openSearch:itemsPerPage>25</openSearch:itemsPerPage>
<entry>
<id>http://gdata.youtube.com/feeds/videos/dto3mB__0Io</id>
<published>2006-12-12T21:39:05.000Z</published>
<updated>2006-12-12T21:39:05.000Z</updated>
<category scheme='http://gdata.youtube.com/schemas/2007/categories.cat' term='News' label='News &amp; Politics'/>
<category scheme='http://schemas.google.com/g/2005#kind' term='http://gdata.youtube.com/schemas/2007#video'/>
<category scheme='http://gdata.youtube.com/schemas/2007/keywords.cat' term='earth'/>
<category scheme='http://gdata.youtube.com/schemas/2007/keywords.cat' term='google'/>
<title type='text'>secret images of google earth</title>
<content type='html'>
&lt;a href="http://www.youtube.com/categories_portal?c=25"&gt;News &amp;amp; Politics&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;
</content>
<link rel='self' type='application/atom+xml' href='http://gdata.youtube.com/feeds/videos/dto3mB__0Io'/>
<link rel='alternate' type='text/html' href='http://www.youtube.com/watch?v=dto3mB__0Io'/>
<link rel='http://gdata.youtube.com/schemas/2007#video.responses' type='application/atom+xml' href='http://gdata.youtube.com/feeds/videos/dto3mB__0Io/responses'/>
<link rel='http://gdata.youtube.com/schemas/2007#video.related' type='application/atom+xml' href='http://gdata.youtube.com/feeds/videos/dto3mB__0Io/related'/>
<author>
<name>anubismoon</name>
<uri>http://gdata.youtube.com/feeds/users/anubismoon</uri>
</author>
<media:group>
<media:title type='plain'>secret images of google earth</media:title>
<media:description type='plain'>
(If you all&#65279; liked this video I made, watch the second part of this video in my video responses. Its called secret images of the book of the dead. ENJOY).
</media:description>
<media:keywords>google, earth</media:keywords>
<yt:duration seconds='160'/>
<media:category label='News &amp; Politics' scheme='http://gdata.youtube.com/schemas/2007/categories.cat'>News</media:category>
<media:content url='http://www.youtube.com/v/dto3mB__0Io' type='application/x-shockwave-flash' medium='video' isDefault='true' expression='full' duration='160' yt:format='5'/>
<media:player url='http://www.youtube.com/watch?v=dto3mB__0Io'/>
<media:thumbnail url='http://img.youtube.com/vi/dto3mB__0Io/2.jpg' height='97' width='130' time='00:01:20'/>
<media:thumbnail url='http://img.youtube.com/vi/dto3mB__0Io/1.jpg' height='97' width='130' time='00:00:40'/>
<media:thumbnail url='http://img.youtube.com/vi/dto3mB__0Io/3.jpg' height='97' width='130' time='00:02:00'/>
<media:thumbnail url='http://img.youtube.com/vi/dto3mB__0Io/0.jpg' height='240' width='320' time='00:01:20'/>
</media:group>
<yt:statistics viewCount='793029'/>
<gd:rating min='1' max='5' numRaters='1544' average='4.44'/>
<gd:comments>
<gd:feedLink href='http://gdata.youtube.com/feeds/videos/dto3mB__0Io/comments'/>
</gd:comments>
</entry>

 

beauzero




msg:3599965
 9:28 pm on Mar 13, 2008 (gmt 0)

Replace totProds = objXML.getElementsByTagName("feed").length
with
totProds = objXML.getElementsByTagName("openSearch:totalResults").length

beauzero




msg:3599966
 9:29 pm on Mar 13, 2008 (gmt 0)

...sorry you need to replace "length" with the equivalent of .InnerText (get the inner text of the node).

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved