bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #31266] GSXML fails when parsing HTML


From: David Wetzel
Subject: [bug #31266] GSXML fails when parsing HTML
Date: Thu, 07 Oct 2010 05:16:06 +0000
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; de-de) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5

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/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]