#!/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
}

