Overview
| Artifact ID: | e282918831ce7dc32a82404bc0be9a2fb345bf1f |
|---|---|
| Ticket: | 623448ffffffffffffffffffffffffffffffffff
string map not correctly mapping |
| User & Date: | svogel on 2002-10-15 09:02:40 |
Changes
- assignee changed to: "dkf"
- cmimetype changed to: "text/plain"
- comment changed to:
The following code-snippet shows the misbehaviour: Some empty p and an "answer"-block should be added to this xml: set data {<cnt><quest><p>q1</p></quest><ans><p>a1</p></an s></cnt>} # simply with map in "question" and "answer" empty "p" are added # and a new "answer"-block should be inserted set result [string map { </p></quest> </p><p></p></quest> </p></ans> </p><p></p></ans> </ans></cnt> </ans><ans><p></p></ans></cnt> } $data] # result is: # <cnt><quest><p>q1</p><p></p></quest><ans><p>a1< /p><p></p></ans></cnt> # the empty "p" tags are inserted, but the last map- pattern is not. # When doing the same in two steps as here: set result [string map { </p></quest> </p><p></p></quest> </p></ans> </p><p></p></ans> } $data] set result [string map { </ans></cnt> </ans><ans><p></p></ans></cnt> } $result] # now everything is fine, result is: <cnt><quest><p>q1</p><p></p></quest><ans><p>a1< /p><p></p></ans><ans><p></p></ans></cnt> This is observed also in Tcl 8.2. As I see in tclCmdMZ.c in function Tcl_StringObjCmd the pointers of the matches are precomputed, may that be the problem? I don't really understand the rest of the code enough to provide a patch. - foundin changed to: "obsolete: 8.4.0"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "svogel"
- subsystem changed to: "18. Commands M-Z"
- title changed to: "string map not correctly mapping"
- type changed to: "Bug"