#!/bin/sh
# the next line restarts using -*-Tcl-*-sh \
exec tclsh "$0" ${1+"$@"}
package require http
proc validate {url} {
set query [::http::formatQuery uri $url]
set p [::http::geturl http://validator.w3.org/check?$query
]
upvar 0 $p state
array set arr $state(meta)
if {$arr(X-W3C-Validator-Status) eq "Valid"} {
set res 0
} else {
set res $arr(X-W3C-Validator-Errors)
}
return [list $url $res]
}
set ifd [open sitemap.txt r]
set ofd [open sitemap.val w]
while {[gets $ifd line] != -1} {
puts $line
puts $ofd [validate $line]
}
close $ofd
close $ifdCategory Internet

