From: Ted N. S. A. GA <te...@ag...> - 2002-12-10 18:30:22
|
In message <3DF...@pr...>you write: > >Hi all, > >I checked out a fresh copy of tclxml (version 2.5 released today), >and found that most (all?) of my changes already were applied >(by Steve Ball presumably). I've been running my patched tclxml >daily for a year, with a lot of chopped off xml, and that works fine. >However, the cvs version does not work as previously noted. >There are some more changes to the cvs version compared to my version. >The main difference seems to be in sgmlparser, and after some >search I found the code: > # Patch from bug report #596959, Marshall Rose >to be the reason. >Just do: > if {0} { > # Patch from bug report #596959, Marshall Rose > if {[string compare [lindex $sgml 4] ""]} { > set sgml [linsert $sgml 0 {} {} {} {} {}] > } > } > >I don't know the reason for this code. This must be sorted out >by the author. This would never have happened if there were a test >case with -final 0 and chopped off xml. So, please someone, >add this so we wont see bugs like this again. > >There remains a question of how to actually use the -final option. >I use it always when there is a risc of incomplete xml. >Is there any reason for using -final 1? What's the advantage? > >In case there are remaining problems you can always extract >my patched TclXML form my whiteboard application. >See "http://hem.fyristorg.com/matben/" > >Best Wishes, Mats Mats, Thanks for the input. I applied your change to dike out the Rose patch from 2.5 (though I do find the fact that Marshall Rose is using tclxml a nice endorsement..) It does not crash any longer, but I can't say that I consider the result correct. It's not what I expect at any rate.. Here's the test case with -final 1 (default) #### package require xml proc cdata {data args} { puts $data } set parser [::xml::parser parseit \ -characterdatacommand cdata ] $parser parse "<the>world</the>" #### It outputs: solabel10% ./doit | od -c 0000000 w o r l d \n 0000006 This makes sense to me. Here's the test case with -final 0.. #### package require xml proc cdata {data args} { puts $data } set parser [::xml::parser parseit \ -characterdatacommand cdata -final 0 ] $parser parse "<the>" $parser parse "world" $parser parse "</the>" $parser configure -final 1 #### It outputs: solabel10% ./doit2 | od -c 0000000 \n w o r l d \n \n 0000010 Note the extraneous leading newline, and the extraneous trailing one (one comes from the "puts" of course..) Ted |