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


_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to