Tk Library Source Code

Artifact [c025c41b76]
Login

Artifact c025c41b7606d1bca3ce8f5f3b0ba6792439291b:

Attachment "bad-htmlparse.tcl" to ticket [640932ffff] added by scottg 2002-11-20 04:36:52.
#!/bin/tclsh

package require Tcl 8.4
package require struct 1.2.1
package require cmdline 1.2
package require htmlparse 0.3

lappend lines {<root>}
lappend lines {<tag>Hi there</tag>} 
lappend lines {<tag}
lappend lines {>Hi there</tag>}
lappend lines {</root>}

proc tag_handler { tag slash attr text } {
	if {[string equal $tag hmstart]} {
		return
	}
	puts "TAG=$tag SLASH=$slash"
}

foreach localline $lines {
	::htmlparse::parse -cmd tag_handler -incvar partial_xml $localline
}