Posted to tcl by wIrEs at Tue Jul 24 12:10:41 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. set node [$root selectNodes {//html[1]/body[1]/div[3]/p[1]/span[3]}]
  11. set text [[[lindex $node 0] childNodes] nodeValue]
  12. puts [$root asXML]