From: Ted N. S. A. GA <te...@ag...> - 2002-12-06 23:14:37
|
Hello folks, I am transitioning a program I had running with tclexpat to use tclxml. I had some problems with -final in tclexpat, (had to patch the code someway or another) and seem to be finding something similar here also. I am using the pure tcl version of tclxml version 2.4. It is installed in a director "lib" beneath my current directory, as is tcllib1.2 Here is my first test script ====Start==== #!/usr/local/bin/tclsh8.4 lappend auto_path lib package require xml proc cdata {data args} { puts $data } set parser [::xml::parser parseit \ -characterdatacommand cdata ] $parser parse "<the>world</the>" ====End==== As expected, it prints world Here is my second test script ====Start==== #!/usr/local/bin/tclsh8.4 lappend auto_path lib 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>" ====End==== It does not print "world" and errors out with a long backtrace: ====Start==== can't read "opts(-statevariable)": no such variable while executing "upvar #0 $opts(-statevariable) state" (procedure "::sgml::tokenise" line 29) invoked from within "::sgml::tokenise $xml $tokExpr $substExpr -internaldtdvariable ::xml::tclparser::parseit(internaldtd) -statevariable ::xml::tclparser::parseit -final ..." ("eval" body line 1) invoked from within "eval {::sgml::tokenise $xml $tokExpr $substExpr} $tokenOptions" (procedure "parse" line 57) invoked from within "parse parseit <the>" (in namespace inscope "::xml::tclparser" script line 1) invoked from within "::namespace inscope ::xml::tclparser parse parseit <the>" ("eval" body line 1) invoked from within "eval $classinfo(-parsecommand) [list $name] $args" ("parse" arm line 5) invoked from within "switch -- $method { configure { # BUG: We're not checking for legal options array set data $args eval $classinfo(-configurecommand) [..." (procedure "::xml::ParserCmd" line 7) invoked from within "::xml::ParserCmd parseit parse <the>" ("eval" body line 1) invoked from within "eval ::xml::ParserCmd parseit [list $method] $args" (procedure "parseit" line 1) invoked from within "$parser parse "<the>"" (file "./doit2" line 14) ====End==== This seems like a pretty basic thing. Any suggestions? Please reply directly to me as well as to the list because sourceforge seems to be unhappy today, and I have not been able to subscribe so far. Thanks, Ted Nolan |
From: Steve B. <Ste...@zv...> - 2002-12-08 01:35:48
|
Dear Ted, You wrote: > I am transitioning a program I had running with tclexpat to use > tclxml. I had some problems with -final in tclexpat, (had to patch the > code someway or another) and seem to be finding something similar here > also. > > Here is my first test script [...snip...] > As expected, it prints > > world Good - that's a start ;-) > Here is my second test script > > ====Start==== > #!/usr/local/bin/tclsh8.4 > > lappend auto_path lib > > 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>" > ====End==== > > It does not print "world" and errors out with a long backtrace: Your script should include: $parser configure -final 1 at the end, just to wind-up the parser. As it is, I would expect it to at least not produce an error, if not to emit "world". > This seems like a pretty basic thing. Any suggestions? There is already an open bug on "-final" in the SF bug tracker (#413341). Please feel free to append your comments to that bug. The bug is currently assigned to Mats, and may be worthwhile reminding him (gently) to fix it ;-) Of course, if you can provide a patch I would be only too happy to incorporate it myself and close the bug report if it is fixed. > Please reply directly to me as well as to the list because sourceforge > seems to be unhappy today, and I have not been able to subscribe so > far. Fixed. You are now subscribed. (New subscribers must be approved, to avoid spammers having access to the list). 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 |