From: Mats B. <ma...@pr...> - 2002-05-17 06:57:24
|
> From: Tobias Gabele <g....@be...> > > is there already a command somewhere in ::xml or ::sgml to quit parsing > based on an event. I want to stop parsing once a specific element occurs > in my elementstartcommand (to save execution time with lenghty xml files > when only one or few values have to be extracted). I could implement > this myself if its not there but maybe someone already came across the > same problem .. > You do return -code 3 (break) from your callback proc. Note a bug if made from element end callback (reported at SourceForge) Fix in sgml::ParseEvent:ElementClose proc: # Invoke callback #uplevel #0 $options(-elementendcommand) [list $tag] $empty $ns # Mats: # Shall be same as sgml::ParseEvent:ElementOpen set code [catch {uplevel #0 $options(-elementendcommand) [list $tag] $empty $ns} msg] #puts " sgml::ParseEvent:ElementClose (exit) state(stack)='$state(stack)'" #return {} return -code $code -errorinfo $::errorInfo $msg /Mats |