Version 0 of using tdom to check generated html

Updated 2003-08-18 15:45:55

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]

 # 

set doc dom parse -html $data set root $doc documentElement

set optionList $root selectNodes {//select/option}

set result {} foreach option $optionList {

   set text [[$option nextSibling] nodeValue]
   set value [$option getAttribute value]
   set selected [$option getAttribute selected ""]

   lappend result [list $text $value]

}

puts $result