Re: NSXMLParser attributeDict enumeration
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