|
From: Steve B. <Ste...@zv...> - 2002-12-10 20:00:22
|
Mats Bengtsson wrote:
> 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.
It is quite clear that making this change will break
regression tests. At this stage we need three things:
1. A test case for bug #596959
2. A test case for bug #413341
3. Make sure that *both* tests pass
According to Marshall's bug report, the Jabber client's
use of TclXML tickled the bug so applying your change
will break that program.
> 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?
The simpler case when you know that the document is complete.
See also below.
> Test case on mac (I've a special pkgIndex file that sets version to 3.0 in order
> to not interfere with other installations):
Until we release v3.0...
> % package require xml
> 3.0
> (Build) 2 %
> (Build) 3 % proc cdata {data args} {
>
>> puts $data
>>}
>
> (Build) 4 %
> (Build) 5 % set parser [::xml::parser parseit \
>
>> -characterdatacommand cdata -final 0]
>
> parseit
> (Build) 6 %
> (Build) 7 % $parser parse "<the>"
>
> (Build) 8 % $parser parse "world"
> world
> (Build) 9 % $parser parse "</the>"
Don't you set '-final 1' at all? Setting that configuration
option to 1 from 0 does a final check that the document
is well-formed. Consider:
$parser parse "<the>"
$parser parse "world"
"<the>world" is not well-formed XML, but you will never
know that because the parsing ends and no error is raised.
Cheers,
Steve Ball
--
Steve Ball | XSLT Standard Library | Training & Seminars
Zveno Pty Ltd | Web Tcl Complete | XML XSL Schemas
http://www.zveno.com/ | TclXML TclDOM | Tcl, Web Development
Ste...@zv... +---------------------------+---------------------
Ph. +61 2 6242 4099 | Mobile (0413) 594 462 | Fax +61 2 6242 4099
|