Hi all,

Created a new bug this morning #61.
It has 32 wild reports connected, so does not occur that much.
I thought it was easy to fix, but it turned out quite tricky.
There's supposed to be no quoting hell in Tcl (so I've read), but wait
until you use xml hehe.

Below is the code fragment with the problem in it. One of the wild
reports looks like this:

list element in braces followed by "}" instead of space
    while executing
"foreach item "{$xml}" {
                switch -regexp -- $item {
                        ^# {append res "{[lrange $item 0 end]} " ; #text item}
                        ^/ {
                                regexp {/(.+)} $item -> tagn..."
    (procedure "xml2list" line 8)

Something like this causes the error I guess:

% set xml "}" ; foreach item "{$xml}" { puts "Res: $item" }
list element in braces followed by "}" instead of space

Perhaps it should be foreach item $xml { ... }
but there's probably a reason for "{$xml}" isn't it ?

If you look at the code fragment below, I guess the string map replaces
too much > and that's why the { } do not always match.

And, by the way, bug report statistics just implemented by Youness seem
messed up (at least for this bug). I'll have a look at that later.


Piece of sxml.tcl:

proc xml2list xml {
        set xml [string map {> "\} \{#text \{" < "\}\} \{"}  $xml]

        foreach item "{$xml}" {
                switch -regexp -- $item {
                        ^# {append res "{[lrange $item 0 end]} " ; #text item}

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
Amsn-devel mailing list

Reply via email to