[XML-SIG] [ pyxml-Bugs-573014 ] adr_parse skips entries and breaks tree

noreply@sourceforge.net noreply@sourceforge.net
Mon, 24 Jun 2002 01:06:49 -0700


Bugs item #573014, was opened at 2002-06-24 10:06
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=106473&aid=573014&group_id=6473

Category: XBEL
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Alexandre Fayolle (afayolle)
Assigned to: Nobody/Anonymous (nobody)
Summary: adr_parse skips entries and breaks tree 

Initial Comment:
Please see
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=150763
for a full description of the bug. 

---------------------------------


I was having a hard time converting an Opera 6 bookmark
file for use
with galeon until I discovered what I consider a bug in
adr_parse.

The output of adr_parse was missing the first bookmark
entry of all
folders and also seem to have hooked the bottem part of
my top-level
bookmarks deeper into the tree structure. As I
understand from the
adr_parse source, the fields "VISITED" and "ORDER" are
optional.
Unfortunately, the "skip of optional fiels"-logic in
the script does not
work [Once a line is read and recognized as not holding
the expected
field, it
is essentially DISCARDED. It is not compared to the
next possible
optional field name. This results in reading to many
line for a single record
and missing the next one completely (w/ "swallow_rest").]

Since this problem only occures for fields that are not
used later on in
the script (ie. parsed needlessly), I just removed the
parsing entirely
and leave the skipping to swallow_rest. I can report
complete success
with that.


- --- /usr/bin/adr_parse	Sun Jun 16 09:47:35 2002
+++ xbel/adr_parse	Sun Jun 23 14:00:17 2002
@@ -73,8 +73,6 @@
         if line=="#FOLDER":
             name=readfield(infile,"NAME")
            
created=parse_date(readfield(infile,"CREATED"))
- -            parse_date(readfield(infile, "VISITED",
0)) # just throw this away
- -            order = readfield(infile, "ORDER", 0)
             swallow_rest(infile)
 
             bms.add_folder(name,created)
@@ -83,7 +81,6 @@
             url=readfield(infile,"URL")
            
created=parse_date(readfield(infile,"CREATED"))
             visited=parse_date(readfield(infile,
"VISITED", 0))
- -            order = readfield(infile, "ORDER", 0)
             swallow_rest(infile)
 
            
bms.add_bookmark(name,created,visited,None,url)


This solution also (like the original code intended for
optional fields)
does not solve the problem of parsing optional fields,
but it
at least allows me to parse the file properly for the
given purpose.


Kai





----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=106473&aid=573014&group_id=6473