Updated 2012-09-09 01:00:22 by RLE

Michael Jacobson (16/06/2004) ~ Using RS's A little XML browser and adding some (very little) code here is a RSS tree browser.

 # A little RSS Browser
 #  based on Richard Suchenwirth's XML Browser
 package require http
 package require BWidget
 package require tdom
 proc recurseInsert {w node parent} {
    set name [$node nodeName]
    if {$name=="#text" || $name=="cdata"} {
        set text [$node nodeValue]
        set fill black
        set icon file
    } else {
        set text <$name
        foreach att [$node attributes] {
            catch {append text " $att=\"[$node getAttribute $att]\""}
        append text >
        set fill blue
        set icon folder
    $w insert end $parent $node -text $text -fill $fill -image [Bitmap::get $icon] -helptext $::name
    foreach child [$node childNodes] {recurseInsert $w $child $node}
 Tree .t -yscrollcommand ".y set"
 scrollbar .y -ori vert -command ".t yview"
 pack .y  -side right -fill y
 pack .t -side right -fill both -expand 1

 #package require autoproxy  ;# add if needed for proxy support
 proc fetch {url} {
    set res [http::data [set tok [http::geturl $url]]]
    http::cleanup $tok
    return $res
 # add more if desired
 set site {http://wiki.tcl.tk/rss.xml
 foreach name $site {
        set xml [fetch $name]
        dom parse  $xml doc
        $doc documentElement root
        recurseInsert .t $root root

MHo 2008-06-26: A Syntax error in startup script... appears. ActiveTcl 8.4.18 on w2k.

LV I made a couple of URL changes in the rss feeds, put the code into a file, and ran it against sparc solaris activetcl 8.5.2 and get:
$ /tmp/rss.tk    
node "domNode141870" already exists
    while executing
"Tree::insert .t end root domNode141870 -text {<rss version="2.0">} -fill blue -image image1 -helptext http://rss.news.yahoo.com/rss/topstories"
    ("eval" body line 1)
    invoked from within
"eval [linsert $args 0 Tree::$cmd .t]"
    (procedure ".t" line 1)
    invoked from within
"$w insert end $parent $node -text $text -fill $fill -image [Bitmap::get $icon] -helptext $::name"
    (procedure "recurseInsert" line 16)
    invoked from within
"recurseInsert .t $root root"
    ("foreach" body line 6)
    invoked from within
"foreach name $site {
        puts "name = $name"
        set xml [fetch $name]
        dom parse  $xml doc
        $doc documentElement root
        recurseInsert .t $root root
    (file "/tmp/rss.tk" line 46)