Tcl Source Code

Artifact [28276b4f1c]
Login

Artifact 28276b4f1c5c7fc1cc52b49c8a0b11ec15bb84b4:

Attachment "http-tcl-8.6.0.0b4-defect.tcl" to ticket [3165071fff] added by anonymous 2011-01-25 11:10:04.
#!/bin/sh
# -*- tcl -*-
# The next line is executed by /bin/sh, but not tcl \
exec tclsh "$0" ${1+"$@"}

# ------------------------------------------------------------------------------
#  tdom-tcl-8.6.0.0b4-defect.tcl
#  Created: 2011.01.24
# ------------------------------------------------------------------------------


# ------------------------------------------------------------------------------

# REF: RSS Reader -- http://wiki.tcl.tk/12801

#-------------------------------------------------------------------------------

package require tdom
package require http

if { ! [ catch { package require autoproxy } ] } {
    autoproxy::init
}

#-------------------------------------------------------------------------------

# --- load xml to temporary file

# --- this podcast feed loads OK
#set url {http://podcastrss.play.it/daily-madden_mp3_128.xml}

# --- this podcast feed fails to load under tcl-8.6.0.0b4
set url {http://www.npr.org/templates/rss/podlayer.php?id=13}
puts "URL: $url"

set file "[ clock seconds ].xml"
set out [ open $file w ]
puts "Temp file opened"

http::geturl $url -channel $out
puts "URL retrieved"

close $out
puts "Temp file created"

set channel [ tDOM::xmlOpenFile $file ]
puts "XML loaded"

set doc [ dom parse -channel $channel ]
puts "XML parsed"

chan close $channel
puts "Channel closed"

#file delete $file
#puts "Temp file deleted"


#-------------------------------------------------------------------------------