• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSXMLParser attributeDict enumeration
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSXMLParser attributeDict enumeration


  • Subject: Re: NSXMLParser attributeDict enumeration
  • From: Martijn van Exel <email@hidden>
  • Date: Mon, 27 Apr 2009 23:01:13 +0200

On Mon, Apr 27, 2009 at 19:05, Quincey Morris
<email@hidden>wrote:

> On Apr 27, 2009, at 08:10, Martijn van Exel wrote:
>
>                currentNode.lat = (double)[attributeDict objectForKey:key];
>> ...
>> Member 'lat' is a double. The above does not work. 'Pointer value used
>> where
>> float was expected'. So I should dereference?
>>
>>               currentNode.lat = (double *)[attributeDict
>> objectForKey:key];
>>
>
> "Dereference" is the wrong word. What you actually did was *cast*, but that
> was the wrong thing to do anyway.
>
> The result of [attributeDict objectForKey:key] is always an object pointer
> (id, NSString*, NSNumber*, etc), never a scalar (int, double, etc). There
> are three possibilities here:
>

[...]

Quincey,

Thanks for the help. The 'doubleValue' is what I was looking for.
Unrelated: one of the XML attributes that needed parsing was a ISO8601 style
date string, for which neither NSDate nor NSDateFormatter curiously does not
seem to provide a parser. Some looking around provided
http://boredzo.org/iso8601parser/ which seems to do the job, but I have to
read up on the ISO8601 date format to tell whether the time zone is handled
correctly.
Thanks again.

Martijn
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >NSXMLParser attributeDict enumeration (From: Martijn van Exel <email@hidden>)
 >Re: NSXMLParser attributeDict enumeration (From: Quincey Morris <email@hidden>)

  • Prev by Date: click in NSButtonCell in NSTableView without selecting table row?
  • Next by Date: RE: Core Data Suddenly Losing Changes
  • Previous by thread: Re: NSXMLParser attributeDict enumeration
  • Next by thread: Current thinking on [NSView allocateGState] ?
  • Index(es):
    • Date
    • Thread