Using an xml::parser in 'streamish' mode i.e.
using the option -final 0 does not seem to work.
Following code :
-------------------------------------------------
package require xml 2.0
proc EStart {name attlist} {
array set attr $attlist
switch $name {
run {
if {[info exists attr(script)]} {
puts "executing $attr(script)"
flush stdout
}
}
}
}
proc EEnd {name} {
puts "end of $name"
}
set parser [xml::parser]
$parser configure -elementstartcommand EStart \
-elementendcommand EEnd
$parser configure -final 0
$parser parse "<run script=\"anotherscript\">"
$parser parse "</run>"
---------------------------------------------------
produces following output :
---------------------------------------------------
% source regparser.tcl
executing anotherscript
{element run remains unclosed around line 0}
%
---------------------------------------------------
Logged In: YES
user_id=88973
I fixed this problem a few weeks back. The latest CVS files
include the patches. If you cant access the cvs repository
you'll have to get steve or I to create you a tarball.
I'm pretty sure this patch is all you need to fix this
problem
diff -c -r1.11 -r1.12
*** tclparser-8.1.tcl 2001/01/17 04:58:54 1.11
--- tclparser-8.1.tcl 2001/02/26 02:11:11 1.12
***************
*** 173,178 ****
--- 173,179 ----
[array get parser -name] \
[array get parser -baseurl] \
[array get parser -validate] \
+ [array get parser -final] \
[array get parser
-defaultexpandinternalentities] \
[array get parser entities] \
[array get parser extentities] \
Logged In: YES
user_id=187700
I did the test again with the latest version; now the error
message changed to :
-----------------------------------------------------------
% source regparser.tcl
executing anotherscript
{end tag "run" does not match open element "" around line 0}
%
-----------------------------------------------------------
Logged In: YES
user_id=202636
Originator: NO
The -final 0 option is broken in all versions of the tclparser since 2.6 and so cannot be used to parse jabber/xmpp streams. It seems that the patch provided in #596959 (sgml parser loses #pcdata in tokenise) clashed with a later change in the caller of the tokenize function and this breaks the token stream.
I've created a patch #1892616 which adds a few tests of parsing a xmpp stream and fixes the problem.