if 0 {phk 2003-08-18 Let's assume your application is generating html pages.
tdom can help in a nice way to test the output.}
Let's get all options from a html select tag:}
package require tdom package require http # get the html page set token [http::geturl http://aspn.activestate.com/ASPN/Cookbook/Tcl/] set data [http::data $token] # parse the html set doc [dom parse -html $data] set root [$doc documentElement] # get all option nodes set optionList [$root selectNodes {//select/option}] set result {} foreach option $optionList { set text [[$option nextSibling] nodeValue] set value [$option getAttribute value] lappend result [list $text $value] } puts $result
if 0 {The result can be used in a tcltest proc or however.
of course can code can be shorter, but I think it explains more this way}