Menu

#6 -final 0 option not working

Script Library
open-fixed
TclXML (91)
6
2002-06-23
2001-04-03
No

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}
%
---------------------------------------------------

Discussion

  • Steve Ball

    Steve Ball - 2001-04-04
    • assigned_to: nobody --> balls
    • priority: 5 --> 6
     
  • Peter Farmer

    Peter Farmer - 2001-04-05

    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] \

     
  • Steve Ball

    Steve Ball - 2001-04-06
    • assigned_to: balls --> doss
     
  • Peter Farmer

    Peter Farmer - 2001-04-09
    • status: open --> closed-fixed
     
  • Lieven Matthys

    Lieven Matthys - 2001-04-10

    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}
    %
    -----------------------------------------------------------

     
  • Lieven Matthys

    Lieven Matthys - 2001-04-10
    • status: closed-fixed --> open-fixed
     
  • Steve Ball

    Steve Ball - 2002-06-23
    • assigned_to: doss --> matben
     
  • Pat Thoyts

    Pat Thoyts - 2008-02-13

    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.

     

Log in to post a comment.