URL:
  <http://savannah.gnu.org/bugs/?31266>

                 Summary: GSXML fails when parsing HTML
                 Project: GNUstep
            Submitted by: dwetzel
            Submitted on: Do 07 Okt 2010 07:16:05 CEST
                Category: Base/Foundation
                Severity: 5 - Blocker
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

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





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?31266>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.gnu.org/


_______________________________________________
Bug-gnustep mailing list
Bug-gnustep@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to