Posted to tcl by de at Fri Jan 04 17:53:07 GMT 2008view pretty
package require tdom set xmlsource {<?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:gml='http://www.opengis.net/gml' xmlns:georss='http://www.georss.org/georss' xmlns:media='http://search.yahoo.com/mrss/' xmlns:yt='http://gdata.youtube.com/schemas/2007'> <id>http://gdata.youtube.com/feeds/api/playlists/DC33DBCFA997445A</id> <updated>2008-01-03T06:59:22.000-08:00</updated> <title type='text'>Media Magic Public Playlist</title> <subtitle type='text'>Media Magic Public Playlist</subtitle> <logo>http://www.youtube.com/img/pic_youtubelogo_123x63.gif</logo> <link rel='alternate' type='text/html' href='http://www.youtube.com/view_play_list?p=DC33DBCFA997445A'/> <link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/playlists/DC33DBCFA997445A'/> <link rel='self' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/playlists/DC33DBCFA997445A?start-index=1&max-results=25'/> <author> <name>rgallimore</name> <uri>http://gdata.youtube.com/feeds/api/users/rgallimore</uri> </author> <generator version='beta' uri='http://gdata.youtube.com/'>YouTube data API</generator> <openSearch:totalResults>3</openSearch:totalResults></feed>} set doc [dom parse $xmlsource] $doc selectNodesNamespaces \ [list openSearch http://a9.com/-/spec/opensearchrss/1.0/ \ atom http://www.w3.org/2005/Atom] puts [$doc selectNodes string(/atom:feed/openSearch:totalResults)]