Hi Phil, I guess I forgot to tell you when you asked me on how to improve this parsing, I told you the commented code should do it, but actually, what the commented code does is this : if we have a '<' char, and no '>' char, we assume it's multiline so we fetch another line, until we find '>' to assume the whole tag is there, bug this causes a problem, think about this file : <entry attr1="whatever" attr2="something else" > </entry> <entry attr1="whatever2" attr2="something else2"> </entry>
Here, I know, it's not "standard", but it could still happen, so we actually should do instead of a "while { [string first > $line] == -1 } " a "while {[count_char_in_string > $line] != [count_char_in_string < $line] } Also, look at your diff log below, you enabled tracing, and you disabled the 'silent'... do we want this ? I guess we'd want to disable silent, in case there's an error (as long as it's outputed in the status_log now, not in stderr), but tracing is not necessary... KKRT On Wed, 31 May 2006 14:40:20 -0400, <[EMAIL PROTECTED]> wrote: > Revision: 6790 > Author: lephilousophe > Date: 2006-05-31 11:40:15 -0700 (Wed, 31 May 2006) > ViewCVS: http://svn.sourceforge.net/amsn/?rev=6790&view=rev > > Log Message: > ----------- > Improves the parsing... > > Modified Paths: > -------------- > trunk/amsn/sxml.tcl > Modified: trunk/amsn/sxml.tcl > =================================================================== > --- trunk/amsn/sxml.tcl 2006-05-31 07:56:07 UTC (rev 6789) > +++ trunk/amsn/sxml.tcl 2006-05-31 18:40:15 UTC (rev 6790) > @@ -175,8 +175,8 @@ > ################################################################# > # Default the attributes currently supported. # > ################################################################# > - set xml_attrs(${xml_invoc}_trace) 0 > - set xml_attrs(${xml_invoc}_silent) 1 > + set xml_attrs(${xml_invoc}_trace) 1 > + set xml_attrs(${xml_invoc}_silent) 0 > set xml_attrs(${xml_invoc}_pedantic) 0 > set xml_attrs(${xml_invoc}_extended) 0 > @@ -530,30 +530,30 @@ > # Both versions are used to avoid a bug on reading files where the > tags are multiline like in .svn/entries for example > > -# gets $xml_file($id) cline > -# incr cfileline > -# if { "$trace" >= 1 } { > -# status_log "Trace: Read line ($status): $cline" > -# } > -# > -# if { [string first "<" $cline] != -1 } { > -# while { [string first ">" $cline] == -1 && ! [eof > $xml_file($id)] } { > -# append cline [gets $xml_file($id)] > -# incr cfileline > -# if { "$trace" >= 1 } { > -# status_log "Trace: Append line ($status): > $cline" > -# } > -# } > -# } > -# append cline "\n" > + gets $xml_file($id) cline > + incr cfileline > + if { "$trace" >= 1 } { > + status_log "Trace: Read line ($status): $cline" > + } > - > - # The following lines read the whole file and put it as a single > line. > - set cline [read $xml_file($id)] > - set cline [string map { "\n" "" } $cline] > + if { [string first "<" $cline] != -1 } { > + while { [string first ">" $cline] == -1 && ! [eof > $xml_file($id)] > } { > + append cline [gets $xml_file($id)] > + incr cfileline > + if { "$trace" >= 1 } { > + status_log "Trace: Append line ($status): > $cline" > + } > + } > + } > append cline "\n" > +# # The following lines read the whole file and put it as a single > line. > +# set cline [read $xml_file($id)] > +# set cline [string map { "\n" "" } $cline] > +# append cline "\n" > + > + > ######################################################### > # The processing of <tag/> is performed by # > # pre-processing each line to convert <tag/> to # > > > This was sent by the SourceForge.net collaborative development platform, > the world's largest Open Source development site. > > > > _______________________________________________ > Amsn-commits mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/amsn-commits -- KaKaRoTo _______________________________________________ Amsn-devel mailing list Amsn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amsn-devel