bugGNUstep - Bugs: bug #31266, GSXML fails when parsing HTML

Group
 
 

bug #31266: GSXML fails when parsing HTML

Submitter:  David Wetzel <dwetzel>
Submitted:  Thu 07 Oct 2010 05:16:05 AM UTC
   
 
Category:  Base/Foundation Severity:  5 - Blocker
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 05 Mar 2011 04:40:13 PM UTC, comment #2: 

No update for months ... guess this one is working.

Richard Frith-Macdonald <CaS>
Group Member
Tue 12 Oct 2010 07:21:49 PM UTC, comment #1: 

I changed the code to assume that the missing value means that we have a 'minimised' attribute ... where the attribute value should be the same as its name.

Richard Frith-Macdonald <CaS>
Group Member
Thu 07 Oct 2010 05:16:05 AM UTC, original submission:  

Hi,

HTML code like:

<OPTION VALUE="unknown" SELECTED>

fails:

(gdb) p  key
$3 = (class NSString *) 0x7f7ff9006470
(gdb) po  key
selected
(gdb) p obj 
$4 = (class NSString *) 0x0

[dict setObject: obj forKey: key]; <<-- will raise

My current local fix is:

static void
startElementFunction(void *ctx, const unsigned char *name,
 const unsigned char **atts)
{
 NSMutableDictionary *dict;

 NSCAssert(ctx,@"No Context");
 dict = [NSMutableDictionary dictionary];
 if (atts != NULL)
   {
     int i = 0;

     while (atts[i] != NULL)
{
  NSString *key = UTF8Str(atts[i++]);
  NSString *obj = UTF8Str(atts[i++]);

   // we seem to have a problem with
   // <OPTION VALUE="unknown" SELECTED>
   // which produced an key "selected", but nil value for obj

   if (obj) {
     [dict setObject: obj forKey: key];
   } else {
     // log warning?
   }

}
   }
 [HANDLER startElement: UTF8Str(name)
     attributes: dict];
}

Which is probably not what we always want, because the 'selected' information is lost.
Probably we could just use NSNull as obj so that we know later that its just a dummy.

Cheers,

David

David Wetzel <dwetzel>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by CaS (Posted a comment)
  • -email is unavailable- added by dwetzel (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-03-05 CaS Open/ClosedIn Test Closed
    2010-10-12 CaS StatusNone Fixed
        Open/ClosedOpen In Test

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code