Posted to tcl by wIrEs at Tue Jul 24 12:10:41 GMT 2007view raw
- #!/bin/sh
- # This line continues for Tcl, but is a single line for 'sh' \
- exec tclsh8.4 "$0" ${1+"$@"}
- package require tdom
- package require http
- set url "http://localhost"
- set page [::http::data [::http::geturl $url]]
- set doc [dom parse -html $page]
- set root [$doc documentElement]
- set node [$root selectNodes {//html[1]/body[1]/div[3]/p[1]/span[3]}]
- set text [[[lindex $node 0] childNodes] nodeValue]
- puts [$root asXML]