Posted to tcl by rfoxmich at Tue Jul 24 12:14:43 GMT 2007view raw

  1. #!/bin/sh
  2. # This line continues for Tcl, but is a single line for 'sh' \
  3. exec tclsh8.4 "$0" ${1+"$@"}
  4. package require tdom
  5. package require http
  6. set url "http://localhost"
  7. set page [::http::data [::http::geturl $url]]
  8. set doc [dom parse -html $page]
  9. set root [$doc documentElement]
  10. puts [$root asXML]
  11.