#!/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"


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


